Commit Graph

362 Commits

Author SHA1 Message Date
Chris Lattner
934bbd0a42 more stdlib hygiene
Swift SVN r28393
2015-05-10 06:35:15 +00:00
Chris Lattner
c1df892d47 improve stdlib hygiene a bit.
Swift SVN r28392
2015-05-10 02:55:18 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Ted Kremenek
9f9bb725cf Rename '_ErrorType' to 'ErrorType'.
Swift SVN r28293
2015-05-07 21:59:29 +00:00
Dmitri Hrybenko
8b392eeea9 Revert "Remove Array.count, it is redundant with protocol extensions"
This reverts commit r28247 while we discuss the change.

Swift SVN r28292
2015-05-07 21:45:30 +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
58601fafc8 Remove Array.count, it is redundant with protocol extensions
Swift SVN r28247
2015-05-07 00:30:41 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
e253881b02 stdlib: protocol extensions: de-underscore indices
Swift SVN r28245
2015-05-07 00:30:35 +00:00
Dmitri Hrybenko
f76ca6243e stdlib: protocol extensions: de-underscore indexOf()
Swift SVN r28244
2015-05-07 00:30:33 +00:00
Dmitri Hrybenko
275cfc0545 stdlib: protocol extensions: de-underscore underestimateCount()
Swift SVN r28240
2015-05-07 00:30:28 +00:00
Dmitri Hrybenko
035d72d5a7 stdlib: protocol extensions: de-underscore contains()
Swift SVN r28236
2015-05-07 00:30:24 +00:00
Dmitri Hrybenko
822ad74194 stdlib: protocol extensions: de-underscore lexicographicalCompare()
Swift SVN r28235
2015-05-07 00:30:23 +00:00
Dmitri Hrybenko
78d1196f33 stdlib: protocol extensions: de-underscore elementsEqual
Swift SVN r28234
2015-05-07 00:30:22 +00:00
Dmitri Hrybenko
7e9063a4af stdlib: protocol extensions: de-underscore enumerate()
Swift SVN r28231
2015-05-07 00:30:12 +00:00
Chris Lattner
37f5452d15 require -> guard.
Swift SVN r28223
2015-05-06 22:53:38 +00:00
Dmitri Hrybenko
cd652bf6cd stdlib: canonicalize 'x.count == 0' to x.isEmpty
Swift SVN r28202
2015-05-06 16:27:41 +00:00
Dmitri Hrybenko
b6a662726b stdlib: replace let-else by require-else
Swift SVN r28104
2015-05-04 00:29:48 +00:00
Chris Lattner
079e8b982b move stdlib from let/else to require.
Swift SVN r28098
2015-05-03 21:45:06 +00:00
Dmitri Hrybenko
d72ae21e7c When building the SDK overlay separately, build SwiftPrivate
SwiftPrivate is not installed in public releases of Xcode.

rdar://problem/20777797
rdar://problem/20780963

Swift SVN r28061
2015-05-02 00:24:12 +00:00
John McCall
ac50cbc801 Enable error-handling in import by default.
Swift SVN r28048
2015-05-01 20:35:28 +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
Dave Abrahams
e2c6c7e90d [stdlib] Fix "#" parameter warnings due to new rules
Swift SVN r27807
2015-04-27 18:15:34 +00:00
David Farler
9e28dc777a Update standard library doc comments to Markdown
rdar://problem/20180478

Swift SVN r27726
2015-04-26 00:07:11 +00:00
Doug Gregor
5b767efe72 Fix three unintended API changes from the argument label defaults change.
Swift SVN r27705
2015-04-24 20:31:41 +00:00
Doug Gregor
793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00
Chris Willmore
c7c7388cf2 Change do-while to repeat-while.
Change all uses of "do { ... } while <cond>" to use "repeat" instead.
Rename DoWhileStmt to RepeatWhileStmt. Add diagnostic suggesting change
of 'do' to 'repeat' if a condition is found afterwards.

<rdar://problem/20336424> rename do/while loops to repeat/while & introduce "repeat <count> {}" loops

Swift SVN r27650
2015-04-23 22:48:31 +00:00
Dmitri Hrybenko
af38ea1381 stdlib: add MutableCollectionType._prext_partition()
Swift SVN r27643
2015-04-23 20:52:00 +00:00
Chris Lattner
cd74bbd49b convert some as? bindings in if/let patterns to use 'as' patterns, suggested by Joe. NFC.
Swift SVN r27628
2015-04-23 04:35:52 +00:00
Joe Groff
b812db06e4 Turn on C function pointer imports by default.
Update tests to match, and rewrite SwiftPrivatePthreadExtras to take advantage of native C function pointer support instead of hacking it up through a stub C++ library.

Swift SVN r27604
2015-04-22 21:11:31 +00:00
Joe Groff
3b30be2580 Revert "Turn on C function pointer imports by default."
This reverts commit r27598, because SourceKit tests need updating to match.

Swift SVN r27600
2015-04-22 20:37:35 +00:00
Joe Groff
b0497db5ec Turn on C function pointer imports by default.
Update tests to match, and rewrite SwiftPrivatePthreadExtras to take advantage of native C function pointer support instead of hacking it up through a stub C++ library.

Swift SVN r27598
2015-04-22 19:54:35 +00:00
Dave Abrahams
ee72b0dc2f [stdlib] Mirror: internal factorization
Swift SVN r27587
2015-04-22 17:23:54 +00:00
Chris Lattner
3ec09eec8e force adopt let/else and the Swift 1.2 if/let extensions in the stdlib a bit, for dogfooding
and cleanup.

I changes cases that had a non-trivial "then" body but a trivial else.  Most of the cases in
the stdlib have a trivial "then" clause, so I didn't change them.




Swift SVN r27567
2015-04-22 06:24:06 +00:00
Nadav Rotem
32211041d2 Rename @semantics -> @_semantics.
Swift SVN r27533
2015-04-21 17:10:06 +00:00
Dmitri Hrybenko
883ac4c11f stdlib: implement a defaulted CollectionType._prext_count() method
Swift SVN r27447
2015-04-18 04:25:15 +00:00
Dmitri Hrybenko
9b94063e29 Migrate away from the deprecated String.toInt()
Swift SVN r27441
2015-04-17 21:46:21 +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
Dmitri Hrybenko
8628a3d4e8 stdlib: _copyToNativeArrayBuffer(): use unsafe more
Now we initialize the array buffer from sequences using unsafe pointer
arithmetic, which avoids extra retain/release traffic.  But since the
size of the sequence is not known in advance, we only initialize as much
as underestimateCount() promises, and fall back to the slow approach for
the tail.  Nevertheless, for collections, where the size is known
precisely, this technique is suboptimal only by one branch.

rdar://20530390

Swift SVN r27380
2015-04-16 20:49:22 +00:00
Dmitri Hrybenko
c48d6aa0ab stdlib: change underestimateCount() into a method
rdar://19895265

Swift SVN r27346
2015-04-16 05:05:17 +00:00
Dmitri Hrybenko
d267b86cb6 stdlib: move the bulk of SequenceType algorithms to protocol extensions
rdar://19895265

Swift SVN r27269
2015-04-14 01:53:19 +00:00
Dmitri Hrybenko
3b57d578bf StdlibUnittest: hide state inside the function scope with a local type
... because Swift does not have C-style function-local statics, but
globally-visible state is bad in any case.

Swift SVN r27235
2015-04-11 06:13:54 +00:00
Dmitri Hrybenko
a84793c60b Fix and re-enable StdlibUnittestRunAllTestsCalledTwice.swift on iOS
Swift SVN r27234
2015-04-11 06:13:52 +00:00
Dmitri Hrybenko
a5d6aec352 StdlibUnittest: add a diagnostic for calling runAllTests() twice
... and fix this issue in the sort() test.

Swift SVN r27215
2015-04-10 21:54:56 +00:00
Dave Abrahams
ac3f047496 [stdlib] Renaming fallout from Mirror API review
toString(x)      => String(x)
toDebugString(x) => String(reflecting: x)
Printable        => CustomStringConvertible
DebugPrintable   => CustomDebugStringConvertible

Also updated comments to clarify these protocols

Swift SVN r27090
2015-04-07 20:32:26 +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
Joe Groff
0f3c1eeb22 RaceTest: Remove workaround for rdar://problem/20418117.
I just fixed this.

Swift SVN r27006
2015-04-05 03:38:27 +00:00
Joe Groff
41f73d43ae Runtime: Try to make lazy ErrorType-to-NSError bridging thread-safe.
Atomically initialize and load the NSError bridging fields within an ErrorType box so that we do the right thing when two threads concurrently coerce the box to NSError.

Swift SVN r26996
2015-04-05 00:17:34 +00:00
Doug Gregor
707e288978 Delete some unnecessary default cases we now warn about.
Swift SVN r26687
2015-03-29 05:42:28 +00:00