Commit Graph

2617 Commits

Author SHA1 Message Date
Alexis Beingessner
2ac37cb76e Merge pull request #5690 from Gankro/versioned
WIP fix resilience build
2016-11-09 12:47:36 -05:00
Doug Gregor
320e439f24 [Standard library] Duplicate subscript requirement in RandomAccessCollection.
Similar to what we did for BidirectionalCollection, duplicate the
subscript-returning-SubSequence requirement in
RandomAccessCollection.
2016-11-08 16:35:26 -08:00
Alexis Beingessner
9ad14ea890 WIP fix resilience build 2016-11-08 19:12:26 -05:00
Doug Gregor
f786a9a230 [Standard library] Duplicate subscript requirement in BidirectionalCollection.
The BidirectionalCollection protocol has no requirements that mention
the associated type 'SubSequence', which means it cannot be easily
inferred. Duplicate the subscript requirement from Collection into
BidirectionalCollection to aid type witness inference.
2016-11-08 16:11:30 -08:00
Doug Gregor
6f362357b2 [Random access collection] Weaken constraints for 'indices' default.
Extensions of the RandomAccessCollection protocol provide two
mutually-incompatible default implementations for 'indices', one of
which uses DefaultRandomAccessIndices<Self> and the other uses
CountableRange<Index>. Type witness inference (rightly) considers the
two ambiguous, although it didn't before, causing regressions.

Remove the same-type constraint

    SubSequence == DefaultRandomAccessIndices<Self>

from the most general extension, so that the more-specialized,
CountableRange version is selected when it's constraints are met, and
the most-general version is selected otherwise.

The down-side to this change is that the most-general version of
'indices', which produces a DefaultRandomAccessIndices<Self>, will be
available in all types that conform to RandomAccessCollection, even if
they have a different Indices type.
2016-11-08 16:11:30 -08:00
Alexis Beingessner
5fdd0c7b5b revert _CocoaDictionaryBuffer indexing design
The use of a lazy var crashes the swift module (de)serializer.
2016-11-07 21:28:24 -05:00
practicalswift
4552fc8f88 [gardening] Use American English: "behaviour" → "behavior" 2016-11-05 20:33:57 +01:00
practicalswift
debeebaa3a [gardening] Fix recently introduced typo: "nsenumator" → "nsenumerator" 2016-11-05 20:32:25 +01:00
Alexis Beingessner
c565c7ca02 Merge pull request #5291 from Gankro/dsindex
[stdlib] Rewriting native hashed collection indices
2016-11-04 11:21:57 -04:00
Alexis Beingessner
e4c5e159c9 remove useless constant redefinition 2016-11-04 03:17:13 -04:00
Alexis Beingessner
3cdc8ec444 remove buffer header to eliminate optional traps 2016-11-04 02:44:29 -04:00
Alexis Beingessner
931f7ba658 actually used the cached keys/values pointer 2016-11-04 01:19:50 -04:00
Alexis Beingessner
5e776e5e39 cleanup initializers in HashedCollections 2016-11-04 01:19:50 -04:00
Alexis Beingessner
428cdac57c leave FIXME for future dictionary bucaneers 2016-11-04 01:01:35 -04:00
Alexis Beingessner
a62f6c6a89 Fix incorrect bitcasts, refactor code to guard against this error. 2016-11-04 01:01:35 -04:00
Alexis Beingessner
b4d97776d8 more comment cleanups 2016-11-04 01:01:35 -04:00
Alexis Beingessner
731aa1494b Properly if-def out bridging code. 2016-11-03 19:55:36 -04:00
Alexis Beingessner
bb0b4be7ac Update comment to clarify why it's interesting, link a relevant impl. 2016-11-03 19:55:36 -04:00
Alexis Beingessner
8eea522e9c rename storage type to be more useful 2016-11-03 19:52:30 -04:00
Alexis Beingessner
b1425ce78b remove _'s from some variables that don't need it 2016-11-03 19:52:30 -04:00
Alexis Beingessner
41fb15f042 rename Buffer <---> Storage in HashedCollections to match conventions 2016-11-03 19:52:30 -04:00
Alexis Beingessner
3144870e86 add new toll-free bridge fast-paths to HashedCollections 2016-11-03 19:52:30 -04:00
Alexis Beingessner
a43c1dfba0 Some minor cleanups in HashedCollections:
* rename bridgingStorage to bridged
* add a missing fixLifetime
* remove useless temporary
2016-11-03 19:52:30 -04:00
Alexis Beingessner
f12d7914e8 update comments in HashedCollections to reflect new design 2016-11-03 19:52:30 -04:00
Alexis Beingessner
052e94a34a refactor HashedCollections to support verbatim bridging 2016-11-03 19:52:30 -04:00
Alexis Beingessner
d179655952 refactor Dictionary to support an empty singleton 2016-11-03 19:52:30 -04:00
swift-ci
7a0e622f17 Merge pull request #5596 from DougGregor/stdlib-warnings 2016-11-01 23:30:37 -07:00
swift-ci
ad1406971f Merge pull request #5595 from slavapestov/fixed-layout-workaround-corelibs-foundation 2016-11-01 23:19:33 -07:00
Doug Gregor
038558baf1 [Standard library] Address warnings. NFC 2016-11-01 23:10:04 -07:00
Slava Pestov
5ded13c8dd stdlib: Make Unsafe{Mutable,}BufferPointer @_fixed_layout to work around rdar://18157434 2016-11-01 23:37:19 -06:00
Slava Pestov
c0f3d8d644 Fix broken build on ARM
There was a @_transparent extension lurking behind an #if, and CI pull
request testing doesn't build the standard library on ARM.
2016-11-01 22:32:38 -07:00
Slava Pestov
f63dff16c7 AST: Don't allow @_transparent on extensions
Quiz: What does @_transparent on an extension actually *do*?

1) Make all members @_transparent?
2) Allow your members to be @_transparent?
3) Some other magical effect that has nothing to do with members?

The correct answer is 1), however a few places in the stdlib defined
a @_transparent extension and then proceeded to make some or all members
also @_transparent, and in a couple of places we defined a @_transparent
extension with no members at all.

To avoid cargo culting and confusion, remove the ability to make
@_transparent extensions altogether, and force usages to be explicit.
2016-11-01 21:14:09 -07:00
Maxim Moiseev
70cf3633b5 Fixing the FloatingPoint.subtracting doc comment (#5581) 2016-11-01 20:13:08 -05:00
Doug Gregor
a66b35d79b [Constraint solver] Allow constraint regeneration when inputs are simplified.
When we process a constraint, the first step is generally to call
getFixedTypeRecursive() to look through type variables. When this
operation actually does non-trivial work, we could save
that result by considering the current constraint "solved" and
generating a new constraint (if needed!) with the simplified types.

This commit adds the infrastructure to do that, because it's important
when getFixedTypeRecursive() starts performing more interesting
substitutions (e.g., handling member types of type
variables). However, enabling for the common case of looking through a
type variable isn't profitable (it's ~2% slower to type-check the
standard library). Stage in this infrastructure change now.
2016-10-31 09:27:22 -07:00
Alexis Beingessner
953e51a97e [stdlib] Handle some outstanding Dictionary indexing-model FIXMEs/TODOs 2016-10-29 10:04:35 -04:00
Alexis Beingessner
b08732cbd4 [stdlib] Update Dictionary comments to reflect new design 2016-10-29 10:04:35 -04:00
Alexis Beingessner
76c6281fea [stdlib] Rewriting native hashed collection indices
Changes:
- Native dictionary and set indices no longer hold references to storage
- Cocoa-based dictionary and set indices no longer hold references to storage
- Removed double indirection trick from hashed collections
- Rewrote storage types to reflect simpler model
- Updated unit tests
2016-10-29 10:04:35 -04:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Ben Cohen
fbed646d82 Merge pull request #5483 from airspeedswift/buffer-protocol
[stdlib] Make various free functions mutating an _ArrayBufferProtocol into extensions. Resolves ABI FIXME #14
2016-10-27 11:38:54 -07:00
Ben Cohen
3f534c254d Merge pull request #5485 from airspeedswift/expectEnd-labels-fixme
[stdlib] Add arg labels to _expectEnd (ABI FIXME #15)
2016-10-26 18:03:51 -07:00
Ben Cohen
81473386df added arg labels to _expectEnd 2016-10-26 12:58:44 -07:00
Ben Cohen
77e13e042e Remove the FIXME that led to this PR 2016-10-26 12:10:42 -07:00
Ben Cohen
f428a16635 tweaked local var names to avoid confusion with self's properties 2016-10-26 12:09:33 -07:00
Ben Cohen
91fa717715 move _arrayAppendSequence to an extension on _ArrayBufferProtocol 2016-10-26 10:21:10 -07:00
Ben Cohen
acb317c308 remove Index == Int constraints by adding missing endIndex: { get } 2016-10-26 10:15:01 -07:00
Ben Cohen
b35f1d10f3 remove some unnecessary self's 2016-10-26 09:21:37 -07:00
Ben Cohen
35d2392d7d Change _ArrayBuffer.replace(subRange:) to replaceSubrange to match RangeReplaceableCollection 2016-10-26 09:19:50 -07:00
Ben Cohen
f0d8ca83ad FIXME(ABI)#14 : add argument labels to _arrayOutOfPlaceReplace 2016-10-26 08:52:58 -07:00
Joe Shajrawi
d49a246063 Merge pull request #5455 from shajrawi/inline_arr_access
always inline Array's getters and setters
2016-10-25 19:26:11 -07:00
Ben Cohen
3cc9b7f337 move _arrayOutOfPlaceReplace into _ArrayBufferProtocol extension 2016-10-25 16:36:28 -07:00