Commit Graph

65 Commits

Author SHA1 Message Date
Doug Gregor
fb253b182a Use a more efficient SubSequence type for lazy map and filter.
Rather than using the default slice type when slicing the collection produced
by a lazy map or filter, slice the base collection and form a new
lazy map/filter collection from it. This allows any optimizations provided by
the collection SubSequence type to kick in, as well as ensuring that slicing
a lazy collection provides the same type as producing a lazy collection of a
slice.

This is technically source-breaking, because someone could have spelled out
the types of slicing a lazy filter or map… but it seems unlikely to matter
in practice and the benefits could be significant.

Fixes ABI FIXME’s #28 and #46.
2017-10-01 15:08:23 -07:00
Arnold Schwaighofer
1214f04757 Fix Lazy.swift.gyb in optimize test mode
EmptyCollection was changed a while ago to use _debugPrecondition checks in the
accesses being tested that fail in optimize mode. Change the test to only expect
a failure in debug mode.

rdar://31897334
2017-06-30 08:48:20 -07:00
Jordan Rose
7295423339 Revert "Re-enable Lazy validation test." (#10330)
The test is still failing on some of the Apple-internal builders. Tracked (still) by rdar://problem/31897334.
2017-06-16 13:46:49 -07:00
Mark Lacey
af49a77b28 Re-enable Lazy validation test.
Works for me locally.

Resolves rdar://problem/31897334.
2017-06-16 08:38:29 -07:00
Ben Cohen
169f3aed6f Revert "Un-XFAIL Lazy.swift test (#9777)"
This reverts commit f9893a9758.
2017-05-19 11:30:33 -07:00
Ben Cohen
f9893a9758 Un-XFAIL Lazy.swift test (#9777) 2017-05-19 10:03:54 -07:00
Arnold Schwaighofer
6c854c2532 [stdlib] Disable failing Lazy.swift.gyb test again
rdar://31897334
2017-04-30 15:33:42 -07:00
Doug Gregor
781082b237 Re-enabled Lazy test.
This was fixed by the recent fix for getConformanceAndConcreteType()'s
creation of substitution maps, PR #9053. Fixes rdar://problem/31780356.
2017-04-27 21:55:49 -07:00
Erik Eckstein
f74e677312 Disabled a test to unblock ci
rdar://problem/31780356
2017-04-24 08:54:59 -07:00
Doug Gregor
70ee642072 [Stdlib] Eliminate LazyFilterIndex.
Eliminate the vestigial type `LazyFilterIndex`, which was
necessary pre-Swift-3 to allow the index to move. Swift 3's indexing
model means that the movement of indices is on the collection itself,
so we no longer need `LazyFilterIndex`: instead, the `Index` type of
the lazy filtered collection is simply the `Index` type of the base
collection, which is a nice convenience: it means you can take indices
from a lazy wrapper around a given collection C and use them with the
collection C (and, with care, vice-versa) without jumping through
extra hoops.
2017-04-20 16:15:41 -07:00
Andrew Trick
30f2cce1b6 Do not run recursive O(n^2) collection slice testing on large collections.
Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.
2017-04-06 17:12:18 -07:00
Andrew Trick
849421799a Revert "SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)"
This reverts commit 1d32586d28.
2017-04-06 10:38:52 -07:00
Andrew Trick
1d32586d28 SE-0138: Proposed amendment to SE-0138: Normalize UnsafeRawBufferPointer Slices (#8222)
* Add sliceability tests for Unsafe(Raw)BufferPointer.

Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.

* Fix and enable testing stdlib Collection instances.

Top-level entry points fully testing a collection instance:
check${Traversal}Collection

One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).

Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.

Fixes a bug in subscriptRangeTests.

The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.

* Give UnsafeRawBufferPointer a distinct slice type.

SubSequence = RandomAccessSlice<Self>

* Fix raw buffer pointer tests after changing the API

* Add UnsafeRawBuffer(rebasing:) initializers.

Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.

Add and update UnsafeRawBufferPointer unit tests.

* Do not run recursive O(n^2) collection slice testing on large collections.

Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.

* Add init(rebasing:) to UnsafeBufferPointer.

This is required for consistency with UnsafeRawBufferPointer.

* Update CHANGELOG.md for SE-0138 amendment: UnsafeRawBufferPointer slice type.
2017-04-06 10:08:09 -07:00
Erik Eckstein
2be1062cf2 Revert "Disable two stdlib tests in optimization mode."
The problem is fixed, so these tests should pass in optimized mode again.

This reverts commit bdd8626374.
2017-02-20 12:49:18 -08:00
Erik Eckstein
bdd8626374 Disable two stdlib tests in optimization mode.
Until rdar://problem/30579713 is fixed.
2017-02-17 14:28:57 -08:00
Ben Cohen
578a52627a Merge branch 'master' into se-147 2017-01-07 13:19:15 -08:00
Ben Cohen
3bdada1773 Merge pull request #6506 from airspeedswift/im-not-warning-you-again
[stdlib] Squash various warnings
2017-01-06 16:51:06 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Ben Cohen
fefc2e40df Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun. 2017-01-05 11:59:49 -08:00
ben-cohen
ce0d713cd6 fixed where clauses, Optional-as-Any and unused vars 2016-12-29 07:58:12 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
airspeedswift
ed5231b47c Numbered all FIXME(ABI) entries for tracking purposes. (#4868) 2016-09-19 16:41:41 -07:00
Dmitri Gribenko
f06c34398a stdlib: Improve tests for Repeated<Element> 2016-09-15 13:34:20 -07:00
Dmitri Gribenko
243a35cd65 Migrate callsites from 'expectEmpty()' to 'expectNil()' 2016-09-10 20:05:42 -07:00
Robert Widmann
740721ab2f Address Dmitri's comments on #3600 2016-08-16 23:59:00 -07:00
Russ Bishop
f0e6c306e4 [stdlib][SE-45] Add prefix(while:) and drop(while:) to Sequence
Includes lazy implementation courtesy of Nate Cook
2016-08-15 14:13:27 -07:00
Robert Widmann
e1ae0391e8 Fixup validation tests 2016-07-30 03:50:16 -07:00
Jacob Bandes-Storch
039ad2bf09 [stdlib] Rename flatten() to joined() (SE-0133) 2016-07-27 23:19:31 -07:00
Andrew Trick
5a8271c621 Rename UnsafePointer allocate & deallocate. (#3608)
As proposed in SE-0107: UnsafeRawPointer:
Rename 'init(allocatingCapacity:)' to 'UnsafeMutablePointer.allocate(capacity:)'
Rename 'deallocateCapacity' to 'deallocate(capacity:)'

`allocate` should not be an initializer. It's primary function is to allocate
memory, not initialize a pointer.
2016-07-19 11:48:18 -07:00
Dave Abrahams
dcbfdb5339 _ includeElement/whereElementsSatisfy predicate => _ isIncluded 2016-07-19 07:05:54 -06:00
Michael Gottesman
fc37603c5f Revert "Implement SE-0118" 2016-07-18 16:44:58 -07:00
Dave Abrahams
4bb21b8a2f _ includeElement/whereElementsSatisfy predicate => _ isIncluded 2016-07-18 14:29:09 -06:00
Michael Gottesman
40e1991e12 Revert "Name and label changes for closure parameters (for review only) (#2981)"
This reverts commit 18406900ba.
2016-07-15 19:45:26 -07:00
Dave Abrahams
18406900ba Name and label changes for closure parameters (for review only) (#2981)
Implement SE-0118 Name and label changes for closure parameters

[SE-0118](https://github.com/apple/swift-evolution/blob/master/proposals/0118-closure-parameter-names-and-labels.md)
2016-07-15 15:31:48 -07:00
Dmitri Gribenko
824bccc871 stdlib: change Collection._copyToNativeArrayBuffer() to be defined in terms of public types 2016-07-11 10:54:43 -07:00
rintaro ishizaki
4b51d85abb [test] Add %target-run-simple-swiftgyb
* Utilize %target-run-simple-swiftgyb where possible
2016-06-15 11:49:44 +09:00
Rintaro Ishizaki
1bdce7ced6 [lit] Add substitutions: %utils and %line-directive
%utils => ${SWIFT_SOURCE_DIR}/utils
%line-directive => ${SWIFT_SOURCE_DIR}/utils/line-directive
2016-06-11 02:41:15 +09:00
practicalswift
68b148cfb1 [gardening] Fix recently introduced typos. 2016-05-06 20:31:38 +02:00
Dmitri Gribenko
d8bb5efe75 stdlib: add tests for index movement in CollectionOfOne 2016-05-04 15:03:22 -07:00
Dmitri Gribenko
f82ca83a68 stdlib: CollectionOfOne: fixes for index movement and tests 2016-05-03 18:44:34 -07:00
Dmitri Gribenko
c594b1d331 EmptyCollection: fixes for index movement and more tests 2016-05-02 11:08:57 -07:00
Max Moiseev
d00dddbdab [stdlib][swift-3-indexing-model] fixing the ReversedCollection/lazy test 2016-04-29 13:46:50 -07:00
Dmitri Gribenko
75d9d9118c stdlib: check associated types of LazyMap and LazyFilter 2016-04-28 12:05:03 -07:00
Dave Abrahams
9bee5d182f [stdlib] location/formLocation => index/formIndex 2016-04-26 17:46:16 -07:00
Dmitri Gribenko
4f68420ceb stdlib: add LazyFilterBidirectionalCollection to preserve traversal kind 2016-04-26 13:33:13 -07:00
Dave Abrahams
47a870cc50 [stdlib] Use location/formLocation for all index movement 2016-04-21 17:13:41 -07:00
Dmitri Gribenko
10697f939f Merge commit '510f29abf77e202780c11d5f6c7449313c819030' into swift-3-indexing-model 2016-04-14 13:45:27 -07:00
Max Moiseev
316c1b088b [stdlib][swift-3-indexing-model] implementing missing methods in Reverse
... and un-xfailing corresponding validation tests.
2016-04-12 16:13:02 -07:00
Max Moiseev
0124bd261f [stdlib][swift-3-indexing-model] un-commenting and un-spliting .lazy usages 2016-04-11 17:58:52 -07:00
Max Moiseev
590f62f3bd [stdlib][swift-3-indexing-model] introducing new LazyCollections
- Instead of just one there are now three:
  - LazyCollection
  - LazyBidirectionalCollection
  - LazyRandomAccessCollection
- ReversedCollection now conforms to BidirectionalCollection
- Lazy tests compile and run (#if'ed pieces that don't typecheck)
2016-04-08 11:06:05 -07:00