Commit Graph

7655 Commits

Author SHA1 Message Date
Dmitri Hrybenko
d97ac3e64c stdlib: rename RangeReplaceableCollectionType.extend() to appendContentsOf()
rdar://21972324

Swift SVN r30607
2015-07-25 00:36:37 +00:00
Joe Groff
b0ec0d6da4 Revert "stdlib: Mark many higher-order function interfaces as 'rethrows'."
This reverts commit r30597, to help detangle it from other potentially-breaking changes that landed
on the bots simultaneously.

Swift SVN r30602
2015-07-24 23:31:59 +00:00
Joe Groff
4be02cab5b stdlib: Mark many higher-order function interfaces as 'rethrows'.
This covers:

- Lifetime-extending wrappers, like withExtendedLifetime, withCString, and withUnsafe*Pointer
- 'map' and friends on Optional
- 'indexOf'

A few APIs I haven't gotten to yet in this first pass:

- Autoclosure APIs, like assert, &&, etc.
- the 'isOrderedBefore' predicate for sorting APIs. The sorting implementation does some microoptimizations with 'inout' closures that violate rethrows checking.
- Strict 'map', 'filter', and friends on CollectionType. These need some plumbing in Lazy to be able to thread a Result-forming transformation through.

Swift SVN r30597
2015-07-24 22:52:23 +00:00
Dave Abrahams
897c34aec9 [stldib] Add missing comments for new reverse collections
Also re-order some decls

Swift SVN r30596
2015-07-24 22:50:50 +00:00
Dave Abrahams
c46b80d6f4 [stdlib] _prext_reverse -> method
Swift SVN r30593
2015-07-24 22:14:38 +00:00
Dmitri Hrybenko
5d22239652 stdlib: fix warnings
Swift SVN r30566
2015-07-24 05:27:56 +00:00
Dmitri Hrybenko
f5de8757e4 stdlib: remove Word and UWord
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
2015-07-24 05:01:32 +00:00
Dave Abrahams
76c6cf59ab [stdlib] Add missing public inits to LazyMapXXX
Swift SVN r30562
2015-07-24 04:29:07 +00:00
Dave Abrahams
ea8c410509 [stdlib] Use new lazy collections in implementations
They pass various operations through to the base
collection (e.g. LazyMapCollection's .count) and thereby avoid taking
the potentially-slower path through the default implementation.

Swift SVN r30554
2015-07-23 21:02:45 +00:00
Dave Abrahams
55b049500a [stdlib] Eliminate redundant eager "filter" implementation
Because we're only allowed a single pass with the closure, the one in
SequenceType is just as good as the one in CollectionType.

Swift SVN r30553
2015-07-23 21:02:44 +00:00
Dave Abrahams
fde48e0b57 [stdlib] "count" property passthrough for LazyMapCollection
Swift SVN r30552
2015-07-23 21:02:43 +00:00
Dave Abrahams
878445a72a [stdlib] Use a nicer generic parameter name...
...with no trailing "_"

Swift SVN r30551
2015-07-23 21:02:42 +00:00
Dave Abrahams
9421aa8db7 [stdlib] Expose base of the new reverse indices
Swift SVN r30550
2015-07-23 21:02:41 +00:00
Dmitri Hrybenko
ce71984eb8 stdlib: add the missing initializer to NonObjectiveCBase
rdar://20321708

Swift SVN r30527
2015-07-23 05:21:43 +00:00
David Farler
9aa5ff1743 Clarify SequenceType.forEach's doc comment
- Add notes for the differences between forEach and for-in loops
- Use TSPL terminology

Swift SVN r30511
2015-07-22 22:56:14 +00:00
Chris Lattner
0001dc27bb remove support for the experiemental "character literals" feature.
Swift SVN r30509
2015-07-22 22:35:19 +00:00
Slava Pestov
05d695f192 stdlib: Fix Linux build breakage from r30493
Swift SVN r30502
2015-07-22 20:38:02 +00:00
Dave Abrahams
7578e2d568 [stdlib] underscore names that were prematurely not underscored
They need to go through API review first.

Swift SVN r30497
2015-07-22 15:43:39 +00:00
David Farler
5eb9f396d6 Default removeFirst for Slice, ArraySlice
Add a default implementation for CollectionTypes where their SubSequence
== Self. That is, mainly, Slice and ArraySlice. This changes the slice's
view of, but not modifying or copying, the underlying collection.

rdar://problem/20302034

Swift SVN r30496
2015-07-22 08:07:37 +00:00
Slava Pestov
56cde6c8ec stdlib: Another simplification in HashedCollections.swift.gyb
Review feedback from Dmitri.

Swift SVN r30495
2015-07-22 07:01:48 +00:00
Slava Pestov
3175c90eac stdlib: Clean up HashedCollection FIXMEs now that generic subclasses of @objc classes work
Fixes <rdar://problem/16824792>.

Swift SVN r30493
2015-07-22 06:34:13 +00:00
Dmitri Hrybenko
0525573de7 stdlib: use syntax sugar for Array
Swift SVN r30489
2015-07-22 04:16:22 +00:00
Joe Groff
eaa1ef8e35 stdlib: Fix sign bug in Float*(integerLiteral:).
Int is signed, not unsigned, so should be converted using sitofp. Fixes rdar://problem/20467684.

Swift SVN r30487
2015-07-22 02:44:37 +00:00
Dave Abrahams
524810f579 [stdlib] Documentation touch-ups for LazyCollection
Swift SVN r30472
2015-07-21 22:35:40 +00:00
Dave Abrahams
6be395d638 [stdlib] Documentation touch-ups for flatten
Swift SVN r30471
2015-07-21 22:35:39 +00:00
Dave Abrahams
b184e6df59 [stdlib] Document complexity of flatMaps
Swift SVN r30470
2015-07-21 22:35:38 +00:00
Ted Kremenek
771761f9f6 Re-apply "stdlib: eliminate unused typealias and tidy up the doc comment""
This reverts commit r30468.

It's not clear if the original commit caused a build regression, but it appears to be resolved now.

Swift SVN r30469
2015-07-21 22:30:59 +00:00
Ted Kremenek
3f41e175b3 Revert "stdlib: eliminate unused typealias and tidy up the doc comment"
This reverts commit r30458.

This is breaking test 'Swift :: stdlib/Algorithm.swift.gyb'

Swift SVN r30468
2015-07-21 22:10:21 +00:00
Dave Abrahams
2088a71259 [stdlib] Document the lazy flatMaps
Swift SVN r30467
2015-07-21 22:01:24 +00:00
Dave Abrahams
a10ef17759 [stdlib] Document flatMap in terms of map + flatten
Swift SVN r30466
2015-07-21 22:01:23 +00:00
Dave Abrahams
e52fb0694d [stdlib] Unbalanced braces in gyb'd source makes my indentation unhappy.
Swift SVN r30465
2015-07-21 22:01:23 +00:00
Dave Abrahams
bccf396bd3 [stdlib] Lazy filter: expose critical base properties + API tweaks
The lazy components, in particular generators and indices, need to offer
access to their base values so they can be mapped back into the
underlying sequences and collections.  Along the way, give some love to:

* documentation comments
* argument labels for predicates
* not storing unneeded properties
* public constructors where appropriate

Swift SVN r30460
2015-07-21 21:22:25 +00:00
Dmitri Hrybenko
8d4866ae9b stdlib: eliminate unused typealias and tidy up the doc comment
Swift SVN r30458
2015-07-21 20:40:37 +00:00
Joe Groff
a7b65aeea1 stdlib: Use shim functions to avoid name+type collisions with CoreFoundation functions.
Fixes rdar://problem/20981649.

Swift SVN r30426
2015-07-21 01:02:04 +00:00
David Farler
ada08bdf2b SequenceType.split enhancements
- De-underscore the API that takes an equatable separator, add doc
  comment, and add a test for it.
- Add a test for the negative maxSplit case.
- Add lifetime tracker for isSeparator closure in the semantic test.

Swift SVN r30413
2015-07-20 21:34:19 +00:00
David Farler
deb69972a7 Clarify equivalence between SequenceType.forEach and for-in loops in doc comment
No functional change.

Swift SVN r30375
2015-07-18 09:08:13 +00:00
David Farler
e930494f35 Don't copy ring buffer in SequenceType.suffix
If the start of the ring buffer is aligned at the left, just wrap the
whole thing directly in an AnySequence and return it. Otherwise, return
a lazy concatenation of the the two slices of the ring buffer. This
prevents a forced full copy of the result.

rdar://problem/21885925

Swift SVN r30374
2015-07-18 09:04:56 +00:00
David Farler
0d1b03086d Add slicing extensions to SequenceType and CollectionType.
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
2015-07-18 06:51:22 +00:00
Dave Abrahams
03f879bb87 [stdlib] Lazy flatMap
Addresses <rdar://problem/20138472>, can close after API review.

Swift SVN r30370
2015-07-18 06:50:27 +00:00
Dave Abrahams
8b9d9a3a25 [stdlib] LazyCollection commenting and cleanup.
Swift SVN r30368
2015-07-18 05:36:27 +00:00
Dave Abrahams
cc1ee51cc5 [stdlib] Make new Reverse*Collection not drop laziness
We used to be only propagating laziness through reverse collections when
the base collection was a LazyCollection<T>, rather than all
LazyCollectionType's. Also updated the flatten tests to check for the
same issue.

Swift SVN r30367
2015-07-18 05:36:27 +00:00
Dave Abrahams
24f930ee67 [stdlib] Add ._prext_flatten for sequences-of-sequences
Swift SVN r30361
2015-07-18 02:58:36 +00:00
Dave Abrahams
9f59c9d52d [stdlib] More lazy doc comment updates
Swift SVN r30359
2015-07-18 02:58:34 +00:00
Andrew Trick
c4f141a121 Reapply "Add test cases for isUnique sanity checks."
Handle linux.

Swift SVN r30357
2015-07-18 02:36:57 +00:00
Dmitri Hrybenko
4f6bedfc51 stdlib: mark some _HeapBuffer APIs public/@testable so that they can be used in tests
Should fix the broken buildbots.

Swift SVN r30354
2015-07-18 01:53:02 +00:00
Joe Groff
6608221a72 stdlib: Remove _UnitTestArray.
rdar://problem/20246497

Swift SVN r30348
2015-07-18 00:14:28 +00:00
Doug Gregor
89ff140503 Move the default implementation of ErrorType._domain into the standard library.
There is no reason for the compiler to be synthesizing a body of
_domain when it can be implemented in a protocol extension. As part of
this, fix a recent regression in the computed domain: it was using
string interpolation, which means that the recent changes not to print
qualified names affected the domain of the generated NSErrors. Oops.

Swift SVN r30343
2015-07-17 23:37:59 +00:00
Andrew Trick
6672ea0dbc Revert "Add test cases for isUnique sanity checks."
This reverts commit r30339.

Temporarilly remove these tests because I forgot to handle linux and
may end up reorganizing the tests.

Swift SVN r30340
2015-07-17 23:37:15 +00:00
Andrew Trick
59909cbd5a Add test cases for isUnique sanity checks.
Swift SVN r30339
2015-07-17 23:22:06 +00:00
Roman Levenstein
8624834b9e Clean-up of the stdlib file forcing pre-specializations.
- Remove public symbols.
- Only one top-level element called _Prespecialize.
- Simpler code.

Swift SVN r30333
2015-07-17 21:20:05 +00:00