Slice types that are RangeReplaceable (like ArraySlice) now slice
themselves in removeFirst(). Previously, these types were picking up
the wrong default implementation, and they were going through
replaceRange(), which caused all indices to be invalidated. The new
implementation preserves all indices.
rdar://22536664
Swift SVN r31918
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Add back a test I removed"
Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add documentation for the cached ascii collation tables"
This reverts commit 31493, 31492, 31491, 31490, 31489.
There are linking errors in SwiftExternalProjects (we probably have to link
against libicucore somewhere).
Swift SVN r31543
Revert "stdlib: Add back a test I removed"
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Move the darwin String implementation over to use the ICU library."
This reverts commit r31477, r31476, r31475, r31474.
Commit r31474 broke the ASAN build.
Swift SVN r31488
- Add Strict/Defaulted Index types to StdlibUnittest
- Test whether a random access index calls its more efficient
customization by tracking successor calls.
- Fix the RandomAccessIndex.advancedBy(n, limit:) API by de-underscoring
the limit parameter
- Inline some internal transparent default implementations to their only
call site
- Attach _RandomAccessAmbiguity type to RandomAccessIndex
rdar://problem/22085119
Swift SVN r30979
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.
Swift SVN r30976
- Remove free Swift functions for advance and distance and replace
them with protocol extension methods:
- advancedBy(n)
- advancedBy(n, limit:)
- distanceTo(end)
- Modernize the Index tests
- Use StdlibUnittest
- Test for custom implementation dispatch
Perf impact: No significant changes reported in the
Swift Performance Measurement Tool.
rdar://problem/22085119
Swift SVN r30958
...replacing it with the new, after passing API review!
* The lazy free function has become a property.
* Before we could extend protocols, we lacked a means for value types to
share implementations, and each new lazy algorithm had to be added to
each of up to four types: LazySequence, LazyForwardCollection,
LazyBidirectionalCollection, and LazyRandomAccessCollection. These
generic adapters hid the usual algorithms by defining their own
versions that returned new lazy generic adapters. Now users can extend
just one of two protocols to do the same thing: LazySequenceType or
LazyCollectionType.
* To avoid making the code duplication worse than it already was, the
generic adapters mentioned above were used to add the lazy generic
algorithms around simpler adapters such as MapSequence that just
provided the basic requirements of SequenceType by applying a
transformation to some base sequence, resulting in deeply nested
generic types as shown here. Now, MapSequence is an instance of
LazySequenceType (and is renamed LazyMapSequence), and thus transmits
laziness to its algorithms automatically.
* Documentation comments have been rewritten.
* The .array property was retired
* various renamings
* A bunch of Gyb files were retired.
Swift SVN r30902
- Added CollectionType and SequenceType.swift.gyb
- Added Slice.swift.gyb
- Added a template file for shared lazy flatMap code between sequences
and collections
- Moved some test structs into the respective Check* files in
StdlibUnittest.
- Slice.swift.gyb is still too slow for Debug-Assert stdlib builds.
I've added a requirement to use the optimized standard library but
we should split this file out even further.
rdar://problem/22095015
Swift SVN r30894
See doc comments on MutableSlice for more information about what it is.
MutableSlice was one of the reasons to clarify and tighten index
invalidation rules. After that change, existing MinimalCollection
test types were performing checks that are too strict according to the
model. Existing algorithms and collections could provide them, but not
MutableSlice. This commit updates MinimalCollection types to perform
index invalidation checks that correspond to new rules.
Part of rdar://20722366. This commit adds the type, but does not wire
it up completely yet.
Swift SVN r30839
FlattenCollection used to evaluate the closure three times per element.
That's acceptable from the technical standpoint, given its lazy
semantics, but not acceptable in practice. This commit fixes it to only
evaluate it two times when it is converted into an array.
This commit also improves tests. The new checks used to fail before the
standard library was fixed.
But there are larger issues with FlattenCollection -- it does not model
CollectionType properly. See next commit.
Swift SVN r30616
These types are leftovers from the early pre-1.0 times when Int and UInt
were always 64-bit on all platforms. They serve no useful purpose
today. Int and UInt are defined to be word-sized and should be used
instead.
rdar://18693488
Swift SVN r30564
rdar://problem/21663830
Add the following new requirements to SequenceType with default implementations:
- dropFirst(n)
- dropLast(n)
- prefix(n)
- suffix(n)
- split(n)
In addition, provide specialized default implementations of these for CollectionTypes with forward, bidirectional, and random-access Index types where possible.
Add the following new requirements to CollectionType with default implementations:
- prefixThrough(n)
- prefixUpTo(n)
- suffixFrom(n)
- split() // isSeparator closure
Add the following convenience APIs:
- dropFirst() -> calls dropFirst(1)
- dropLast() -> calls dropLast(1)
Add a tentative underscored API:
- split() // takes Equatable separator.
Some APIs have undefined behavior when creating slices where the endpoints go beyond the bounds of the underlying collection. This will be fixed later by trapping creation of slices with invalid indices (rdar://problem/21822657).
Swift SVN r30371
The big one, though, is the use of 'lazy' in _masterThreadOneTrial.
Removing it takes the function from 62s to 2s on my machine.
That's rdar://problem/20875936.
Swift SVN r30292
Otherwise, the length of the sequence is in principle lost. If you know
you have a sequence of less than 100 elements, you still want to know
exactly how many elements you initialized from it.
Swift SVN r30104
This is a straight-up "oops". You could always get to these typealiases via
the protocol, but like the member requirements you should have to say so.
Swift SVN r29952
The way we pass and compose source locations, messages, etc. needs to be
brought under control before too many more tests get written. This is
the first step.
Swift SVN r29928
Add a shared buffer to every range replaceable mutable collection to
track logical mutations, and invalidate all indices on every mutation.
Swift SVN r29917
- Clean up tests
- Create API-specific test structures with clearer labels
- Use `OpaqueValue`s in test collections
- Make tests non-generic to allow array literal declarations
- Remove some unused functions
- Test return values for mutating functions that return a value
- Add expect* test source locations
- Add _customRemoveLast ad-hoc default implementation for `removeLast`
- Add default implementation for reserveCapacity that does nothing.
Swift SVN r29905
ExtensibleCollectionType's operations can all be represented by the
primitive range replacement operation, so fold it into
RangeReplaceableCollectionType.
In addition, provide default implementations of
RangeReplaceableCollectionType's methods.
- New tests added for combinations of (static, generic) calls and
(default, custom) implementations.
- Mark free Swift functions as unavailable with a message to direct the
developer to the protocol methods.
- Mark ExtensibleCollectionType as available with a message added to
direct the developer to the right protocol.
rdar://problem/18220295
Swift SVN r29857