Commit Graph

188 Commits

Author SHA1 Message Date
Jordan Rose
b378a5043f [stdlib] Dictionary and Set's removeAtIndex should return the element.
For Dictionary, that's a (KeyType, ValueType) pair. For Set, that's just
the set element type. This is more consistent with the removeAtIndex on
RangeReplaceableCollectionType (which Dictionary and Set don't conform to).

rdar://problem/20299881

Swift SVN r30696
2015-07-27 20:32:55 +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
Dmitri Hrybenko
0525573de7 stdlib: use syntax sugar for Array
Swift SVN r30489
2015-07-22 04:16:22 +00:00
David Farler
241de1a1c3 Add popFirst/popLast implementations for some collections
Add the following non-customizable implementations:

- popFirst/popLast for Collections whose SubSequence == Self.
- Array.popLast
- ContiguousArray.popLast
- Set.popFirst
- Dictionary.popFirst

Swift SVN r30278
2015-07-16 22:52:05 +00:00
Dmitri Hrybenko
d9726efbb2 stdlib: rename Set's generic parameter from T to Element
Same for SetGenerator and SetIndex.

Part of rdar://21429126

Swift SVN r29619
2015-06-24 20:41:51 +00:00
Arnold Schwaighofer
4d4329b0e0 Add executable_test to the validation test suite
Swift SVN r29278
2015-06-03 23:28:43 +00:00
Doug Gregor
2b01e748fd Remove uses of parameter ‘#’ from the validation testsuite.
Swift SVN r28843
2015-05-20 20:21:45 +00:00
Dmitri Hrybenko
fe239e3d03 stdlib: de-underscore sort() and partition() methods
Swift SVN r28839
2015-05-20 19:34:36 +00:00
Greg Parker
15b99a26d9 Test: Add %target-clang substitution.
Swift SVN r28758
2015-05-19 06:08:36 +00:00
Dmitri Hrybenko
843d8a4eb7 stdlib: protocol extensions: de-underscore map()
Swift SVN r28502
2015-05-13 01:58:46 +00:00
Dmitri Hrybenko
61214ec55b stdlib: remove Sliceable conformance from String
Swift SVN r28442
2015-05-11 20:58:31 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Dmitri Hrybenko
10ab07ade5 Revert "Remove {Dictionary,Set,UnsafeMutableBufferPointer,UnsafeBufferPointer}.count"
This reverts commit r28248 while we discuss the change.

Swift SVN r28291
2015-05-07 21:45:28 +00:00
Dmitri Hrybenko
8ac6c7cf8f Remove {Dictionary,Set,UnsafeMutableBufferPointer,UnsafeBufferPointer}.count
These APIs are redundant with APIs that come from protocol extensions.

Swift SVN r28248
2015-05-07 00:30:43 +00:00
Dmitri Hrybenko
e96ade89a9 stdlib: protocol extensions: de-underscore isEmpty
Swift SVN r28241
2015-05-07 00:30:29 +00:00
Dmitri Hrybenko
78d1196f33 stdlib: protocol extensions: de-underscore elementsEqual
Swift SVN r28234
2015-05-07 00:30:22 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00
Dmitri Hrybenko
fd14e70e48 stdlib: rename find() to indexOf() per API review
Swift SVN r27849
2015-04-28 00:30:37 +00:00
Dmitri Hrybenko
f6090c1c89 stdlib: make CollectionType._prext_isEmpty dynamically dispatched
This change makes isEmpty faster for Dictionary and Set, when invoked
from generic algorithms.

Swift SVN r27736
2015-04-26 00:08:14 +00:00
Dmitri Hrybenko
bc50b2f58d stdlib: stop using CFSetCreateCopy() in set bridging
Use -[NSSet copyWithZone:] instead.

CFSetCreateCopy() is buggy in OSes that ship today: it copies the set
unconditionally, even if it is immutable, resulting in O(n) bridging.

Swift SVN r27733
2015-04-26 00:08:13 +00:00
Doug Gregor
0523a09560 Update validation testsuite for the argument label default changes.
Swift SVN r27706
2015-04-24 20:31:43 +00:00
Dmitri Hrybenko
02d254047b stdlib: add a hook for dynamic dispatch in CollectionType.find()
This hook allows Set.find() to be equally efficient in static and
generic contexts.

This time, with correct tests.

Swift SVN r27404
2015-04-17 05:03:28 +00:00
Dmitri Hrybenko
e94b0f9b40 Revert "stdlib: add a hook for dynamic dispatch in CollectionType.find()"
This reverts commit r27402.  It broke tests.

Swift SVN r27403
2015-04-17 04:59:29 +00:00
Dmitri Hrybenko
fe53f87dfc stdlib: add a hook for dynamic dispatch in CollectionType.find()
This allows Set.find() to be equally efficient in static and generic
contexts.

Swift SVN r27402
2015-04-17 04:19:49 +00:00
Dmitri Hrybenko
0d6374bb58 stdlib/HashedCollections: skip computing the hash for lookups in empty
collections

Swift SVN r27395
2015-04-17 01:56:19 +00:00
Dave Abrahams
0464c3d957 [stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]
Retire the old components now that the new ones have passed API review.

<rdar://20406937> covers the migration fallout of this change.

Swift SVN r27092
2015-04-07 20:32:31 +00:00
Michael Gottesman
2c143aee96 Revert "[stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]"
This reverts commit r27081. It broke the build.

Swift SVN r27086
2015-04-07 17:21:03 +00:00
Dave Abrahams
a80b1a4caa [stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]
Retire the old components now that the new ones have passed API review.

<rdar://20406937> covers the migration fallout of this change.

Swift SVN r27081
2015-04-07 15:20:40 +00:00
Dmitri Hrybenko
ff2dd6320a stdlib: fix coding style
When colon specifies is-a relationship between types, we put spaces on
both sides of the colon.

Swift SVN r27016
2015-04-05 05:54:55 +00:00
Michael Gottesman
0255a5b948 Revert "[stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]"
This reverts commit r26904. Fixing the build.

Swift SVN r26912
2015-04-02 22:55:30 +00:00
Dave Abrahams
0b40374d10 [stdlib] [Generator|Sequence]Of => Any[Generator|Sequence]
Retire the old components now that the new ones have passed API review.

<rdar://20406937> covers the migration fallout of this change.

Swift SVN r26904
2015-04-02 21:55:22 +00:00
Chris Lattner
20f8f09ea8 Land: <rdar://problem/19382905> improve 'if let' to support refutable patterns and untie it from optionals
This changes 'if let' conditions to take general refutable patterns, instead of
taking a irrefutable pattern and implicitly matching against an optional.

Where before you might have written:
  if let x = foo() {

you now need to write:
  if let x? = foo() {
    
The upshot of this is that you can write anything in an 'if let' that you can
write in a 'case let' in a switch statement, which is pretty general.

To aid with migration, this special cases certain really common patterns like
the above (and any other irrefutable cases, like "if let (a,b) = foo()", and
tells you where to insert the ?.  It also special cases type annotations like
"if let x : AnyObject = " since they are no longer allowed.

For transitional purposes, I have intentionally downgraded the most common
diagnostic into a warning instead of an error.  This means that you'll get:

t.swift:26:10: warning: condition requires a refutable pattern match; did you mean to match an optional?
if let a = f() {
       ^
        ?

I think this is important to stage in, because this is a pretty significant
source breaking change and not everyone internally may want to deal with it
at the same time.  I filed 20166013 to remember to upgrade this to an error.

In addition to being a nice user feature, this is a nice cleanup of the guts
of the compiler, since it eliminates the "isConditional()" bit from
PatternBindingDecl, along with the special case logic in the compiler to handle
it (which variously added and removed Optional around these things).




Swift SVN r26150
2015-03-15 07:06:22 +00:00
Chris Lattner
e120cd5cf0 revert changes to testsuite for if/let pattern restriction.
Swift SVN r25512
2015-02-24 20:41:12 +00:00
Chris Lattner
6d0a7c39e8 adjust the validation tests to the new if/let syntactic restrictions.
Thanks to Dmitri for doing almost all of this.


Swift SVN r25443
2015-02-20 23:56:30 +00:00
Dmitri Hrybenko
a99093581b stdlib: change {Dictionary,Set}.Generator to value semantics
Generator observes a snapshot of the collection.  Mutating the
collection should not have any effect on existing generators.

rdar://19726013

Swift SVN r25171
2015-02-11 07:12:25 +00:00
Dave Abrahams
ed8c302a93 [stdlib] Move tests that challenge a debug compiler
...into the validation suite.  This is the wrong solution but at least
the bots will continue to run all the tests and we won't regress.

Swift SVN r24934
2015-02-04 01:53:14 +00:00
Dmitri Hrybenko
b7e61965eb Remove redundant test
Swift SVN r24696
2015-01-24 00:12:21 +00:00
Andrew Trick
e2760a7036 Add a return statement to Variant[Set|Dictionary]Storage.removeAtIndex.
This fast path is only taken when the code is specialized.
Fixes <rdar://problem/19331717> Optimizer breaks Set<T> and Dictionary<K, V>

Swift SVN r24479
2015-01-16 21:10:48 +00:00