Commit Graph

3290 Commits

Author SHA1 Message Date
Nate Cook
ce28cdee93 Update the error message when subscripting String with Int. (#27069)
Instead of referring to a doc comment that isn't really accessible to the
developer, let's be accurate about what type they should be using here.
2019-09-10 12:23:09 -05:00
ravikandhadai
d1c5663958 Merge pull request #26863 from ravikandhadai/oslog-strings
[oslog][stdlib-private] Add support for interpolating strings in the new os_log APIs.
2019-09-05 19:31:30 -07:00
Daniel Rodríguez Troitiño
67711fe280 Remove warnings from TestJSONEncoder compilation.
Since the introduction of #26357/SR-11160 the TestJSONEncoder seems to
have been emitting the new warnings related to tuples being incorrectly
pattern matched.

The changes remove the incorrect code (removing the parenthesis around
the pattern).

Should not have any other effect (and the effect was not normally
visible if the test was successful, anyway).
2019-09-05 13:36:15 -07:00
Karoy Lorentey
52782cfd4e Merge pull request #26882 from lorentey/delete-forward
[test] Add a quick test for NSEvent.SpecialKey.deleteForward’s rawValue
2019-09-04 15:05:57 -07:00
taylorswift
210ec69a1b comparable enums 2019-09-01 13:41:16 -05:00
Ravi Kandhadai
03c6365671 [oslog][stdlib-private] Add support for interpolating strings
in the new os_log APIs.
2019-08-30 17:04:39 -07:00
ravikandhadai
dcd0893efe Merge pull request #26815 from ravikandhadai/oslog-integer-types
[oslog][stdlib-private] Refactor and generalize interpolation of Int type in the new os_log APIs so as to extend to other integer types.
2019-08-30 16:22:18 -07:00
Erik Eckstein
5f01b0d1b3 tests: make two tests more resilient to destroy hoisting 2019-08-29 10:49:54 +02:00
swift-ci
b8f42d6165 Merge pull request #26466 from nvzqz/is_concrete_builtin 2019-08-28 19:10:37 -07:00
Michael Ilseman
d30ec5ba79 Merge pull request #26884 from milseman/cache_alignment
[test] Disable misaligned indices test prior to 5.1
2019-08-28 14:23:11 -07:00
swift-ci
8f5677148f Merge pull request #26881 from mikeash/skip-new-mirror-tests-on-old-oses 2019-08-28 12:28:54 -07:00
eeckstein
8ea5df1758 Merge pull request #26803 from eeckstein/destroy-hoisting
SILOptimizer: a new optimization to hoist destroys of memory locations
2019-08-28 19:49:22 +02:00
Arnold Schwaighofer
10fd6fb4e7 Merge pull request #26878 from aschwaighofer/conditionalize_kvopaths_tests
Conditionalize KVOKeyPaths tests that only work with Swift 5.1 (2)
2019-08-28 07:44:25 -07:00
Mike Ash
0345186725 [Stdlib] Skip Mirror.swift's Subclass, Fields, and Cases tests on older OSes.
rdar://problem/54754304
2019-08-28 09:57:17 -04:00
Erik Eckstein
34e80b7f85 tests: fix array lifetime problem in the DispatchData test.
It causes a use-after-free problem with more aggressive destroy hoisting in the compiler.
Also replace tabs with spaces in this file.
2019-08-28 12:14:38 +02:00
Nikolai Vazquez
da14b8345c Never inline isConcrete_false test
The `Builtin.isConcrete` function is apparently sensitive to inlining in
unoptimized builds.
2019-08-27 16:51:09 -07:00
Nikolai Vazquez
ba0612f2e9 Add Builtin.isConcrete<T>(T.Type) -> Int1
Returns `true` if `T.Type` is known to refer to a concrete type. The
implementation allows for the optimizer to specialize this at -O and
eliminate conditional code.

Includes `Swift._isConcrete<T>(T.Type) -> Bool` wrapper function.
2019-08-27 16:51:09 -07:00
Michael Ilseman
774788ac18 [test] Disable misaligned indices test prior to 5.1
Misaligned indices were fixed in 5.1, but we should disable the test
when testing back deployment.

Adds a shared helper to StdlibUnittest for the run time check.
2019-08-27 15:13:38 -07:00
Karoy Lorentey
48a4ddae8b [test] Add a quick test for NSEvent.SpecialKey.deleteForward’s rawValue 2019-08-27 14:45:34 -07:00
David Smith
92eaeca0b2 Fix test to ignore two unused classes still present on old runtimes 2019-08-27 13:52:25 -07:00
Arnold Schwaighofer
d745096f84 Conditionalize KVOKeyPaths tests that only work with Swift 5.1 (2)
This test was added in f34ef5d for a fix in 5.1 and is going to fail in 5.0

rdar://54754307
2019-08-27 12:33:23 -07:00
Karoy Lorentey
895f13657f Merge pull request #26760 from lorentey/♪-hold-me-use-me-autorelease-me-♬
[stdlib] AutoreleasingUnsafeMutablePointer: eliminate questionable pointer use
2019-08-27 10:22:04 -07:00
Karoy Lorentey
d5ea371eed [test] Add some high-level tests for AutoreleasingUnsafeMutablePointer 2019-08-26 20:09:53 -07:00
Arnold Schwaighofer
fe69a86929 Revert "Remove stdlib and runtime dependencies on Foundation and CF"
It is causing bots to fail.

* Revert "The __has_include(<os/system_version.h>) branch here wasn't quite right, we'll just use the dlsym one for now"

This reverts commit f824922456.

* Revert "Remove stdlib and runtime dependencies on Foundation and CF"

This reverts commit 3fe46e3f16.

rdar://54709269
2019-08-26 13:00:08 -07:00
Ravi Kandhadai
8641dc7310 [oslog][stdlib-private] Refactor and generalize implementation of
interpolation of Int types in the new os_log APIs so that it is
easier to extend to other integer types. Based on this, add support
for interpolating Int32 types.
2019-08-24 19:08:55 -07:00
swift-ci
3256392211 Merge pull request #26630 from Catfish-Man/shim-shim-sher-ee 2019-08-23 17:08:59 -07:00
David Smith
3fe46e3f16 Remove stdlib and runtime dependencies on Foundation and CF 2019-08-23 14:10:23 -07:00
Stephen Canon
d80b1d39a3 Backout SE-0246 (#26809)
* Revert "Add availability information to the new Math function protocols (#24187)"

This reverts commit d2f695935f.

* Revert "SE-0246: Protocols and static functions (#23824)"

This reverts commit 57a4553832.

* Expected abi changes.
2019-08-23 16:41:17 -04:00
Scott Perry
6c992d91b2 Return nil on applying() failure instead of crashing (rdar://problem/53663769) 2019-08-08 16:50:13 -07:00
Greg Titus
db3b0d949c Merge pull request #26054 from gregomni/kp_closures
[ConstraintSystem][SE-0249] Key Path Expressions as Functions
2019-08-07 20:43:11 -07:00
Brent Royal-Gordon
66f914d20f Make keypath literal in closure only once 2019-08-06 07:52:56 -07:00
Brent Royal-Gordon
2a885a0863 Add runtime tests for key path literal closures 2019-08-06 07:52:56 -07:00
David Smith
0887299d9e Fix sub-scalar index distances in foreign UTF8 views 2019-08-02 16:45:42 -07:00
Andrew Trick
c8a16d3d9b Merge pull request #26041 from atrick/remove-ptrcast-diag
Remove the Swift-3-era pointer casting diagnostic.
2019-07-30 09:59:00 -07:00
Karoy Lorentey
62c1cf31d2 Merge pull request #26022 from anandabits/Identifiable
Add Identifiable protocol to the standard library
2019-07-26 17:38:26 -07:00
David Smith
e7b1107212 Merge pull request #26374 from Catfish-Man/unindex-set
Remove unused Foundation subclasses
2019-07-26 17:09:45 -07:00
David Smith
48266a6f56 Remove unused Foundation subclasses 2019-07-26 14:47:43 -07:00
Pavel Yaskevich
effd0d00c6 Merge pull request #26302 from xedin/remove-label-mismatch-from-lookup
[Diagnostics] Don't filter overload set candidates based on labels in lookup
2019-07-26 10:34:23 -07:00
swift-ci
f34ef5db85 Merge pull request #24356 from zetasq/zetasq-fix-KVO 2019-07-25 15:14:18 -07:00
Pavel Yaskevich
44f82f256f [TypeChecker] Adjust some of tests improved/regressed after removal of UR_LabelMismatch 2019-07-25 00:36:00 -07:00
David Smith
d091ecb009 Restore more-correct behavior of getting the full contents of bridged NSStrings containing invalid UTF-8 2019-07-16 12:05:56 -07:00
Stephen Canon
dc5915cdb5 Replace stdlib and test/stdlib 9999 availability. (#26108)
* Replace stdlib and test/stdlib 9999 availability.

macOS 9999 -> macOS 10.15
iOS 9999 -> iOS 13
tvOS 9999 -> tvOS 13
watchOS 9999 -> watchOS 6

* Restore the pre-10.15 version of public init?(_: NSRange, in: __shared String)

We need this to allow master to work on 10.14 systems (in particular, to allow PR testing to work correctly without disabling back-deployment tests).
2019-07-12 16:30:36 -04:00
Xi Ge
1535bea268 FixCode: issue a separate note for protocol-stub fixit when the fixit location is in another file
Under non-editor mode, the fixit for inserting protocol stubs is associated with a note
pointing to the missing protocol member declaration which could stay in a separate file from
the conforming type, leading to the behavior of rdar://51534405. This change checks if
the fixit is in a separate file and issues another note to carry the fixit if so.

rdar://51534405
2019-07-10 12:30:54 -07:00
Andrew Trick
d2a0ae29d3 Remove the Swift-3-era pointer casting diagnostic.
Remove this additional note when attempting to incorrectly initialize UnsafePointer:

  Pointer conversion restricted: use '.assumingMemoryBound(to:)' or
  '.bindMemory(to:capacity:)' to view memory as a type.

The note was added for Swift 3 migration. The idea was to get projects
building as quickly as possible and effectively tag bad behavior so it
could be corrected later. That worked, but now it's been working
against us for the past couple of releases. Too much new code is using
these two APIs and the vast majority of uses are not only incorrect,
but much more simply expressed without them. Instead, programmers need
to be made aware that the UnsafeRawBufferPointer API already does what
they want... but we can work on that problem as separate task.

Most uses of these APIs are something like:

  return rawptr.assumingMemoryBound(to: T.self).pointee

or

  UnsafeRawPointer(ptr).bindMemory(to: UInt16.self, capacity: 2).pointee

Instead of simply

  return rawptr.load(as: T.self)

I've even seen programmers do this:

  extension UnsafeRawPointer {
    var uint8: UInt8 {
      let uint8Ptr = self.bindMemory( to: UInt8.self, capacity: 1 )
      return uint8Ptr[0]
    }
  }

...instead of simply using either UnsafeRawPointer.load or UnsafeRawBufferPointer's subscript.
2019-07-09 15:47:22 -07:00
Scott Perry
3924d1a99d Merge pull request #25825 from numist/numist/diff-inverse-master
add `CollectionDifference.inverse()` and test coverage
2019-07-09 14:46:20 -07:00
Jordan Rose
659c49766b Merge pull request #25984 from jrose-apple/same-gamgee
[runtime] Handle same-type constraints when resolving generic params

rdar://problem/52364601
2019-07-09 13:43:24 -07:00
Matthew Johnson
0a8f154ab2 Add Identifiable protocol to the standard library 2019-07-09 14:17:20 -05:00
Jordan Rose
4b8068d1df [runtime] Handle same-type constraints when resolving generic params
Generic parameters for a context are normally classified as "key",
meaning they have actual metadata provided at runtime, or non-key,
meaning they're derivable from somewhere else. However, a nested
context or constrained extension can take what would be a "key"
parameter in a parent context and make it non-key in a child context.
This messes with the mapping between the (depth, index) representation
of generic parameters and the flat list of generic arguments. Fix this
by (1) consistently substituting out extension contexts with the
contexts of the extended types, and (2) using the most nested context
to decide which parameters are key, instead of the context a parameter
was originally introduced in.

Note that (1) may have problems if/when extensions start introducing
their /own/ generic parameters. For now I tried to be consistent with
what was there.

rdar://problem/52364601
2019-07-08 17:46:14 -07:00
Mike Ash
33b7c04842 [Test] Disable the Runtime.demangleTruncate test on older OSes so it doesn't fail in back deployment testing.
rdar://problem/52357361
2019-07-08 15:34:13 -04:00
Xiaodi Wu
dfb90b7e1c Merge pull request #25745 from xwu/sync-decimal
[Foundation] Synchronize Decimal overlay with swift-corelibs-foundation
2019-07-05 14:42:16 -04:00