Commit Graph

4464 Commits

Author SHA1 Message Date
Joe Groff
f1cd3122fc KeyPaths: Stub out support for instantiating external components with trivial descriptors. 2018-07-25 11:09:04 -07:00
swift-ci
e2a1a689de Merge remote-tracking branch 'origin/master' into master-next 2018-07-25 11:08:56 -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
swift-ci
066dd10dfb Merge remote-tracking branch 'origin/master' into master-next 2018-07-24 20:49:47 -07:00
Ben Cohen
df22c3647c [stdlib] Build the standard library as Swift 5 (#18121)
* Update std lib to Swift 5.0

* Disable Unicode.* warnings for now

* Slow path to resiliently handle the case where an unknown rounding rule is passed

* Remove resilience from Encoding/DecodingError (which should only happen on slow paths anyway)

* internal typealiases now need @usableFromInline

* Force inlining on Array._owner.get
2018-07-24 20:47:58 -07:00
swift-ci
d98fd93c77 Merge remote-tracking branch 'origin/master' into master-next 2018-07-24 18:29:48 -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
swift-ci
36ead37964 Merge remote-tracking branch 'origin/master' into master-next 2018-07-24 17:49:02 -07:00
swift-ci
4edbd83576 Merge pull request #17923 from allevato/unicode-properties-docs 2018-07-24 17:45:06 -07:00
swift-ci
0dd8fb0061 Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 23:09:57 -07:00
Nate Cook
3d7dfc232b [stdlib] Update complexity docs for seq/collection algorithms (#17254)
* [stdlib] Update complexity docs for seq/collection algorithms

This corrects and standardizes the complexity documentation for Sequence
and Collection methods. The use of constants is more consistent, with `n`
equal to the length of the target collection, `m` equal to the length of
a collection passed in as a parameter, and `k` equal to any other passed
or calculated constant.

* Apply notes from @brentdax about complexity nomenclature

* Change `n` to `distance` in `index(_:offsetBy:)`

* Use equivalency language more places; sync across array types

* Use k instead of n for parameter names

* Slight changes to index(_:offsetBy:) discussion.

* Update tests with new parameter names
2018-07-24 01:01:34 -05:00
swift-ci
9095b8762a Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 10:29:27 -07:00
Ben Cohen
f4eae3fff0 Clean up debug printing code (#18126) 2018-07-23 10:11:37 -07:00
swift-ci
ad5dab2227 Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 03:49:27 -07:00
Karoy Lorentey
9ff95733f4 Merge pull request #17974 from lorentey/hide-hashed-collection-details
[stdlib] Set/Dictionary: Make some implementation details non-inlinable
2018-07-23 11:40:37 +01:00
swift-ci
6f74f5bb5c Merge remote-tracking branch 'origin/master' into master-next 2018-07-21 17:49:44 -07:00
Ben Cohen
4694310e51 [stdlib] Some minor cleanup (#18130)
* Remove case destructuring to _

* Remove some Iterator.Element

* Which idiot wrote this? Oh.

* Switch NibbleSort to just use default impls... shouldn't change perf
2018-07-21 17:29:57 -07:00
swift-ci
1c77358086 Merge remote-tracking branch 'origin/master' into master-next 2018-07-20 14:29:50 -07:00
swift-ci
48eb400a93 Merge pull request #17826 from brentdax/public-optional 2018-07-20 14:12:55 -07:00
swift-ci
107dfa1aa5 Merge remote-tracking branch 'origin/master' into master-next 2018-07-19 15:09:31 -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
swift-ci
3aef406989 Merge remote-tracking branch 'origin/master' into master-next 2018-07-18 15:49:08 -07:00
Matt Diephouse
f0cb64dec3 Conform Never to Error, Equatable, Comparable, and Hashable (#16857) 2018-07-18 15:41:14 -07:00
swift-ci
bbe8675fde Merge remote-tracking branch 'origin/master' into master-next 2018-07-18 11:49:19 -07:00
Ben Cohen
33c2efe32e Update random docs to SystemRandomNumberGenerator (#18042) 2018-07-18 11:45:57 -07:00
swift-ci
db0da0f0b1 Merge remote-tracking branch 'origin/master' into master-next 2018-07-18 11:29:16 -07:00
Pavel Yaskevich
d8e9bff817 Merge pull request #18039 from xedin/transparent-magnitude
[stdlib] Try to make `magnitude` transparent again by using `&+`
2018-07-18 11:20:18 -07:00
swift-ci
3e9d33f3cf Merge remote-tracking branch 'origin/master' into master-next 2018-07-18 10:49:25 -07:00
Nate Cook
2536277362 [stdlib] Various documentation improvements (#18013)
- Revise Bool.toggle() discussion and fix attribute placement
- Revise to Hasher abstracts and discussions
- Correct the name of the remainder operator
- Clean up deprecations and paste-os w/in UnsafePointer
2018-07-18 12:41:22 -05:00
Pavel Yaskevich
8f8a441c49 [stdlib] Try to make magnitude transparent again by using &+
Improvements from SE-0213 made constant propagation more
precise but, as a side-effect, resulted in more false positives,
to mitigate that `magnitude` has marked as `@inline(__always)`
but it could be made transparent again by using `&+` operator.
2018-07-18 00:25:10 -07:00
swift-ci
6f860ad2b3 Merge remote-tracking branch 'origin/master' into master-next 2018-07-17 20:09:49 -07:00
Ben Cohen
074dc43c3e Restore Sequence conformance to FlattenSequence.Iterator (#18024) 2018-07-17 20:00:30 -07:00
swift-ci
2776303905 Merge remote-tracking branch 'origin/master' into master-next 2018-07-17 18:00:27 -07:00
Pavel Yaskevich
a9660c7bc5 Merge pull request #17860 from xedin/SE-0213
[TypeChecker] SE-0213: Implement literal init via coercion
2018-07-17 17:53:25 -07:00
swift-ci
f0ad0f59c3 Merge remote-tracking branch 'origin/master' into master-next 2018-07-17 13:40:09 -07:00
Ben Cohen
be894e4510 Replace Random.default with SystemRandomNumberGenerator (#17989) 2018-07-17 13:17:06 -07:00
Pavel Yaskevich
aa9b3d8474 [TypeChecker] SE-0213: Implement literal init via coercion
Implementation is as follows: In `preCheckExpression` try to
detect if there is `T(literal)` call in the AST, replace it with
implicit `literal as T`, while trying to form type-checked AST,
after constraint solving, restore source information and drop
unnecessary coercion expression.

Resolves: rdar://problem/17088188
Resolves: rdar://problem/39120081
Resolves: rdar://problem/23672697
Resolves: rdar://problem/40379985
2018-07-17 12:08:59 -07:00
swift-ci
9b12d01fc2 Merge remote-tracking branch 'origin/master' into master-next 2018-07-17 09:09:17 -07:00
Nate Cook
4b9d611b87 [stdlib] Use nonmutating method to access _FixedArray contents on subscript (#17911) 2018-07-17 10:54:23 -05:00
Karoy Lorentey
c599572e56 [stdlib] _CocoaFastEnumerationStackBuf: make internal
_CocoaFastEnumerationStackBuf is now only used by Set and Dictionary, in code that isn’t exposed in the ABI. Remove @usableFromInline.
2018-07-17 16:00:12 +01:00
Karoy Lorentey
c19547a2e0 [stdlib] Set: Update methods defined in terms of key-value
insert(value, forKey: key), removeValue(forKey: key) doesn’t make sense for Set. Simplify.
2018-07-17 15:59:51 +01:00
Karoy Lorentey
543e050702 [stdlib] Set, Dictionary: Remove _Mutable*Buffer protocols
They had but a single type conforming them, so they did not pull their weight as internal interface-enforment protocols.
2018-07-17 15:59:51 +01:00
Karoy Lorentey
5a22b9016a [stdlib] Split _HashBuffer into four different protocols
This allows Set’s internal types not to define Key, Value, SequenceElement & SequenceElementWithoutLabels typealiases.

Splitting the protocol on the mutable/immutable axis allows us to remove some obsolete method definitions.
2018-07-17 15:59:51 +01:00
Karoy Lorentey
9756677d72 [stdlib] Set, Dictionary: Remove RawStorage typealiases
These were an artifact of gybbing.
2018-07-17 15:59:51 +01:00
Karoy Lorentey
a339f88a29 [stdlib] NFC: cosmetic changes 2018-07-17 15:59:51 +01:00
Karoy Lorentey
99f348800d [stdlib] Set, Dictionary: Make Cocoa->native conversion non-inlinable 2018-07-17 15:59:50 +01:00
Karoy Lorentey
47cae81c75 [stdlib] Set, Dictionary: Make Cocoa iteration state non-inlinable. 2018-07-17 15:59:50 +01:00
Karoy Lorentey
4ac2fc7517 [stdlib] _SwiftDeferredNS*: Clean up gyb artifacts
Remove typealiases and member functions made obsolete by de-gybbing.
2018-07-17 15:59:50 +01:00
Karoy Lorentey
619db38b5d [stdlib] Make non-verbatim bridged Set and Dictionary implementations internal
There is no reason to expose these in the Swift ABI.
2018-07-17 15:59:50 +01:00
Karoy Lorentey
c72bf4cdfa [stdlib] Make Set & Dictionary enumerators internal
There is no reason to expose these in the Swift ABI.
2018-07-17 15:59:50 +01:00