Commit Graph

3245 Commits

Author SHA1 Message Date
Joe Groff
7129745bf0 TBDGen: Include property descriptor in TBD output. 2018-07-25 11:09:04 -07:00
Joe Groff
f1cd3122fc KeyPaths: Stub out support for instantiating external components with trivial descriptors. 2018-07-25 11:09:04 -07:00
Stephen Canon
35db40c9f9 Make BinaryInteger._binaryLogarithm() return Int instead of Self (#18219)
Returning `Self` was probably a hack from when shifts were required to be homogenous and we didn't have good generic inits between integer types. Returning Int is more natural, because:

1. Dimensional analysis says that we shouldn't expect the logarithm to have the same type.
2. Int is guaranteed to be able to represent any object size, and BinaryInteger does not admit sparse representations, so the logarithm of the value cannot exceed allocated storage size.
3. Every single use case in the stdlib and tests is either unchanged or simplified by this change.
2018-07-25 14:04:32 -04:00
Joe Groff
ae4d40ac85 SILGen: Fix key paths that reference internal private(set) decls from other files.
The setter needs to be given hidden linkage so that other files can still form key paths to it.
2018-07-25 10:49:29 -07:00
Joe Groff
b607e549f1 Adjust the key path component tags so that the trivial property descriptor can be zero.
…and thus more likely to be folded with another zero constant in the module and/or put in a zero-initialized page.
2018-07-25 10:49:29 -07:00
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Matt Wright
82cbee5367 Merge pull request #18157 from mwwa/os-log-format-test-fixup
os_log test failing
2018-07-24 10:29:33 -07:00
Pavel Yaskevich
41917d9f49 Merge pull request #18148 from xedin/match-call-arguments-imporovements
[TypeChecker] Improve argument label matching
2018-07-23 15:32:09 -07:00
Matt Wright
7e5a091065 os_log test failing
Rather than have the entire log format test disabled because of the
long-double test, disable just the long-double test itself.

Fixes: rdar://41380265
2018-07-23 13:34:44 -07:00
Pavel Yaskevich
91e330c289 [TypeChecker] Improve argument label matching
* Improve label mismatch callback:
 - Split "missing label" callback into 3 - missing, extraneous, incorrect (with typo(s));
 - Allow label callbacks to indicate if it's a fatal error or not;
* Improve matching of the variadic parameters;
* Improve matching of the parameters with defaults;
* Try to look for an argument with matching label before fallback to
  forced claming (if allowed).
2018-07-21 23:21:42 -07:00
Max Moiseev
193548118f [test] Skip MapKit test on iOS 9.3.5 2018-07-20 15:00:27 -07:00
swift-ci
48eb400a93 Merge pull request #17826 from brentdax/public-optional 2018-07-20 14:12:55 -07:00
Huon Wilson
72a87a76f8 [stdlib] Work-around incorrect name resolution with conditional BidirectionalCollections.
If a type conditionally conforms to BidirectionalCollection, suffix's (and the
others) use of `index` ends up dispatching through `Collection.index` seemingly
because it is a protocol requirement. The intended function is
BidirectionalCollection's overloaded `index` (which _isn't_ connected to a
protocol requirement), which is called for non-conditional conformances. As
such, this is a work-around to stop code crashing.

Noticed in SR-8022, rdar://problem/41216424.
2018-07-19 12:22:32 +10:00
Matt Diephouse
f0cb64dec3 Conform Never to Error, Equatable, Comparable, and Hashable (#16857) 2018-07-18 15:41:14 -07:00
ktopley-apple
ccdcd94120 Merge pull request #17982 from ktopley-apple/ktopley-dispatch-rdar40775762
Change the signature for DispatchData.enumerateBytes() to match that …
2018-07-18 08:03:49 -07:00
Kim Topley
7b0991f0a8 Change the signature for DispatchData.enumerateBytes() to match that of Data.enumerateBytes() for Swift 4.2 and obsolete the old version.
rdar://problem/40775762
2018-07-17 11:00:55 -07:00
Michael Ilseman
85e1f96318 [test] Version-guard some emoji tests.
Gate some emoji tests on a new enough iOS version.
2018-07-16 17:31:58 -07:00
Daiki Matsudate
a3552f393e [stdlib] Add compactMapValues(_:) to Dictionary (#15017)
add compact map values on hashed collections
2018-07-14 22:35:16 -07:00
Ben Cohen
a8328a820f Factor a couple more universal inits into _Pointer (#17952) 2018-07-14 22:14:27 -07:00
Ben Cohen
436b8610e7 [stdlib][WIP] Factor out common parts of pointer types and de-gyb (#17951)
* Add conformances to _Pointer and remove from pointer types

* De-gyb pointer files
2018-07-14 07:36:45 -07:00
Michael Ilseman
c8ed8f9a2f [test] Update String tests for older iOS versions 2018-07-13 16:08:36 -07:00
Brent Royal-Gordon
b6e35038b2 [SILGen] Output a different message for failed IUO force-unwraps
Modifies SILGen and the `Swift._diagnoseUnexpectedNilOptional` call to print a slightly different message for force unwraps which were implicitly inserted by the compiler for IUOs. The message is chosen based on the presence of certain flags in the `ForceValueExpr`, not on the type of the value being unwrapped.
2018-07-12 19:09:56 -07:00
Michael Ilseman
30450671fa Merge pull request #15593 from allevato/unicode-properties
[SE-0211] Add Unicode properties to Unicode.Scalar
2018-07-11 13:27:31 -07:00
Nate Cook
92900d4e7d Add an array initializer with access to uninitialized storage (#17774)
* Add an Array initializer for using an uninitialized capacity.

* Add tests for reserveCapacity & init(_unsafeUninitializedCapacity:...:)
2018-07-10 10:34:57 -05:00
Tony Allevato
b454e8d0f4 Make emoji properties Darwin only.
Ubuntu 16.04 doesn't have a recent enough ICU to support these; we need a better long-term solution, such as bundling ICU with the toolchain.
2018-07-09 18:42:42 -07:00
Ben Cohen
685f31b0e2 [stdlib] Migrate stdlib tests of Swift 3 (#17427)
* First sweep of Swift 3 stdlib test upgrades

* Review feedback

* Remove a handful more #if >=4.0

* Fix up Dictionary tests
2018-07-08 09:37:01 -07:00
Mark Lacey
dec3341ee0 Merge pull request #17748 from rudkx/remove-swift3-from-some-tests
Remove -swift-version 3 from a handful of tests and update them appro…
2018-07-06 15:59:40 -07:00
Mishal Shah
381ae3bef4 Disable test/stdlib/os_log_format.m test due to unexpected failure rdar://problem/41380265 2018-07-06 11:49:25 -07:00
Tony Allevato
d0e93acb00 Various fixes to Unicode.Scalar.Properties.
- numericValue returns nil instead of .nan for non-numerics
- Remove small-string optimizations from _scalarName that failed on 32-bit archs
- Put case mappings back into U.S.Properties
- Added more sanity tests
2018-07-05 20:42:56 -07:00
Mishal Shah
95c80cf2ce Merge pull request #17761 from apple/update-master-xcode-10-beta-3
Update master to build with Xcode 10 beta 3, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs
2018-07-05 15:53:29 -07:00
Mishal Shah
811b1d0879 Update master to build with Xcode 10 beta 3, OS X 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-07-05 10:57:03 -07:00
Mark Lacey
5e75b1ad3b Remove -swift-version 3 from a handful of tests and update them appropriately.
These are all tests that would otherwise fail if the expression type
checker support for Swift 3 is removed.

I've moved some of the code from deleted Migrator tests into new
Constraints tests that verify that we do not support the constructs.
2018-07-04 20:58:21 -07:00
Tony Allevato
8eef50f6a9 Merge branch 'master' into unicode-properties 2018-07-04 08:42:35 -07:00
Joe Groff
06ac23842f IRGen: Correctly set and honor the "is reflectable" bit on structs and classes.
If we only emit an opaque reflection record for a struct or class, then we can't reflect its fields. We failed both to clear the "is reflectable" bit in the context descriptor for non-reflectable structs, and to check for the bit before trying to present a struct's fields as children in the runtime. rdar://problem/41274260
2018-07-03 13:52:46 -07:00
Slava Pestov
31ab93b82c Remove Swift 3-specific tests 2018-07-02 21:14:22 -07:00
Itai Ferber
1d6ec73fec Merge pull request #17634 from itaiferber/master
Fix availability statements in CodableTests.swift
2018-06-29 13:18:40 -07:00
Tony Parker
8009e87716 Merge pull request #17607 from lutherjm/pr/40440282
URLComponents is missing percentEncodedQueryItems.
2018-06-29 13:06:48 -07:00
Itai Ferber
432603f85b Fix availability statements in CodableTests.swift 2018-06-29 10:58:48 -07:00
Karoy Lorentey
a4e9109618 Merge pull request #17396 from lorentey/anyhashable-is-not-hashable
[stdlib] Fix AnyHashable's Equatable/Hashable conformance
2018-06-29 17:38:08 +01:00
Mike Ash
e32b77a6a7 Merge pull request #17515 from mikeash/nested-nserror-to-error-bridging
[Runtime] Extend ObjC bridging casts to convert NSError to Error when nested in a container type.
2018-06-29 06:47:23 -07:00
Ben Cohen
a4230ab2ad [stdlib] Update stdlib to 4.0 and reorganize compatibility shims (#17580)
* Update stdlib to 4.0 and move all compatibility shims into a dedicated source file
2018-06-29 06:26:52 -07:00
Jim Luther
6fbb2a4b25 Fixed indentation in changes. Fixed availability in test. 2018-06-28 18:19:23 -07:00
Michael Ilseman
6c03cea1ca [test] Guard OS-dependent Unicode behavior with check 2018-06-28 14:57:27 -07:00
Jim Luther
a7d3efd6f8 URLComponents is missing percentEncodedQueryItems. I added it and modified the URLComponents test code to make sure it works. 2018-06-28 14:10:47 -07:00
Mike Ash
e992f46764 [Runtime] Extend ObjC bridging casts to convert NSError to Error when nested in a container type.
rdar://problem/39349762
2018-06-28 13:35:25 -04:00
Robert Widmann
1aca4d141d Migrate some stdlib tests to swift 4 2018-06-27 12:38:52 -07:00
Huon Wilson
350f7d8494 [test] Move test using StdlibCollectionsUnittest to validation-test. 2018-06-26 17:43:40 +10:00
Alex Hoppen
545302ea33 Merge pull request #17481 from ahoppen/sequence-test
[stdlib] Make test for Sequence.map actually test a sequence
2018-06-25 17:13:32 -07:00
Alex Hoppen
06b01534bc [stdlib] Make test for Sequence.map actually test a sequence
AnySequence just forwards the call to map to its underlying storage
which used to be an Array (and thus a collection).
2018-06-25 14:44:45 -07:00
Ben Cohen
a51cc89b11 Replace _CharacterView with a typealias (#17472) 2018-06-25 13:22:09 -07:00