Commit Graph

2952 Commits

Author SHA1 Message Date
Dmitri Hrybenko
ce95ac26cd stdlib: adjust _NSDictionaryCoreType to match Foundation nullability audit
Swift SVN r27729
2015-04-26 00:08:10 +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
Dmitri Hrybenko
8a3e78f3a7 Mirrors can be compiled on non-ObjC runtime
Swift SVN r27716
2015-04-25 03:45:01 +00:00
Dmitri Hrybenko
4b067db516 stdlib: fix indentation
Swift SVN r27707
2015-04-24 20:37:40 +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
Dmitri Hrybenko
65dcd98c59 stdlib: rename _CollectionGeneratorDefaultsType.{Element -> _Element}
Swift SVN r27676
2015-04-24 04:37:14 +00:00
Dmitri Hrybenko
8b2a1b4e1e stdlib: remove _CollectionSliceDefaultsType
The newest type checker improvements fix the underlying issue.

Swift SVN r27670
2015-04-24 02:42:08 +00:00
Devin Coughlin
8c7d3cc0cb Runtime: Change runtime to use lexicographic version comparison for availability
Change the runtime so that version comparisons use a lexicographic rather
than a component-wise comparison.

rdar://problem/20661965

Swift SVN r27669
2015-04-24 02:20:11 +00:00
Dmitri Hrybenko
7afe30ec7d stdlib: make all collections sliceable, first steps
This commit adds a minimally working Slice type and minimal tests.  Even
though it might seem logical how the new protocol requirements are
injected in the CollectionType hierarchy, it is very fragile and
required many attempts to get the typechecker to finally accept it.
Because I want to ensure that the type checker does not regress, I'm
commiting a patch that does not do much yet.

Swift SVN r27665
2015-04-24 01:27:15 +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
cce80114fc stdlib: Deprecate CFunctionPointer.
rdar://problem/20477688 is tracking making this (and other things) unavailable when Xcode 7 is released.

Swift SVN r27626
2015-04-23 04:24:34 +00:00
Dmitri Hrybenko
8e3bcef97c stdlib: eliminate _CollectionType, thanks to the new witness type solver
Swift SVN r27622
2015-04-23 01:58:46 +00:00
Dmitri Hrybenko
2ce7dee53d stdlib: remove _SequenceType, thanks to the new type witness solver
Swift SVN r27620
2015-04-23 01:37:31 +00:00
Dmitri Hrybenko
005c76ba07 Revert "stdlib: make all collections sliceable, first steps"
This reverts commit r27617.  Too late, it crashes the type checker now.

Swift SVN r27618
2015-04-23 00:56:30 +00:00
Dmitri Hrybenko
0cdf289c9c stdlib: make all collections sliceable, first steps
This commit adds a minimally working Slice type and minimal tests.  Even
though it might seem logical how the new protocol requirements are
injected in the CollectionType hierarchy, it is very fragile and
required many attempts to get the typechecker to finally accept it.
Because I want to ensure that the type checker does not regress, I'm
commiting a patch that does not do much yet.

Swift SVN r27617
2015-04-23 00:26:08 +00:00
Dmitri Hrybenko
730e6afee0 Revert "stdlib: make map() dynamically dispatched"
This reverts commit r27607.  It broke parse_stdlib_* tests.

Swift SVN r27609
2015-04-22 22:30:45 +00:00
Dmitri Hrybenko
21e5a83631 stdlib: make map() dynamically dispatched
This change tries to recover the performance regression in map() that
was caused by moving map() to a protocol extension and degrading the
static type information (when mapping a collection, we only know that it
is a sequence).  Adding map() to the witness table allows us to provide
a specialized implementation for collections, and hopefully recover the
lost performance.

This is a speculative change, I don't have performance numbers.  I will
watch the performance buildbots and if this change does not help, I'll
revert.

Swift SVN r27607
2015-04-22 22:08:16 +00:00
Dmitri Hrybenko
d9848a6c41 stdlib: migrate last() to use a protocol extension
Swift SVN r27602
2015-04-22 20:42:04 +00:00
Dmitri Hrybenko
7a40ec0916 stdlib: simplify code
Swift SVN r27601
2015-04-22 20:42:01 +00:00
Dave Abrahams
d3f52de076 [stdlib] Mirror: handle chaining
Swift SVN r27592
2015-04-22 17:23:58 +00:00
Dmitri Hrybenko
701dfbecd2 stdlib: use let-else in maxElement()
Swift SVN r27571
2015-04-22 07:06:40 +00:00
Dmitri Hrybenko
7bbb0071a3 stdlib: fix a bug in SequenceType.startsWith() introduced in r27567
Swift SVN r27569
2015-04-22 07:06:39 +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
Dmitri Hrybenko
69c5a0be3b stdlib: add a public init to _HeapBufferStorage so that it can be used
in tests

Swift SVN r27563
2015-04-22 05:24:20 +00:00
Dmitri Hrybenko
e1adeab0ba stdlib: move SequenceType and related APIs to a separate file
Swift SVN r27560
2015-04-22 04:32:42 +00:00
Dmitri Hrybenko
b68fdd2316 stdlib: reword doc comment for SequenceType.flatMap()
Swift SVN r27559
2015-04-22 04:32:41 +00:00
Dmitri Hrybenko
31831c44bb stdlib: change non-API names to be more descriptive
Swift SVN r27558
2015-04-22 04:32:38 +00:00
Nadav Rotem
32211041d2 Rename @semantics -> @_semantics.
Swift SVN r27533
2015-04-21 17:10:06 +00:00
Dmitri Hrybenko
526c45b9b0 stdlib: mark free functions on optionals for removal
Swift SVN r27511
2015-04-21 00:15:13 +00:00
Dmitri Hrybenko
62403ecc23 stdlib: fix up documentation for new methods
Swift SVN r27510
2015-04-21 00:15:03 +00:00
Dave Abrahams
7cd1429f59 [stdlib] Add _getSuperclass(AnyClass)
We'll need this to handle class mirrors properly

Swift SVN r27500
2015-04-20 21:58:24 +00:00
Dave Abrahams
62d958e322 [stdlib] Supply base class mirrors, v2
Swift SVN r27499
2015-04-20 21:58:23 +00:00
Dave Abrahams
e905e7dc31 [stdlib] Supply base class mirrors
Swift SVN r27497
2015-04-20 21:58:22 +00:00
Dave Abrahams
0c8a717896 [stdlib] Don't report base as a Mirror child
This results in silly infinite recursions.  We need an API change to
access the base instance mirror.

Swift SVN r27496
2015-04-20 21:58:21 +00:00
Chris Willmore
d4db635e3d Add object literal syntax and _{Color,Image}LiteralConvertible protocols
Add syntax "[#Color(...)#]" for object literals, to be used by
Playgrounds for inline color wells etc. The arguments are forwarded to
the relevant constructor (although we will probably change this soon,
since (colorLiteralRed:... blue:... green:... alpha) is kind of
verbose). Add _ColorLiteralConvertible and _ImageLiteralConvertible
protocols, and link them to the new expressions in the type checker.
CSApply replaces the object literal expressions with a call to the
appropriate protocol witness.

Swift SVN r27479
2015-04-20 12:55:56 +00:00
Dmitri Hrybenko
70828ef4fb stdlib: stop using _CollectionType to the largest extent possible
Swift SVN r27448
2015-04-18 04:25:25 +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
3a1410fdec stdlib: add a default implementation for CollectionType.generate()
Swift SVN r27442
2015-04-17 21:55:09 +00:00
Dmitri Hrybenko
971718b45c stdlib: mark declarations that we plan to remove as deprecated
Swift SVN r27437
2015-04-17 18:15:00 +00:00
Joe Groff
bdbb5a9a5a Remove now-unnecessary default from exhaustive (Bool, Bool) switch.
Swift SVN r27411
2015-04-17 05:30:27 +00:00
Joe Groff
82aa6e720e stdlib: Implement "_isValidSubscript(_:hoistedIsNativeNoTypeCheckBuffer:)" for ContiguousArrayBuffer.
ContiguousArrayBuffer is used as the buffer for Array when ObjC interop is disabled, so even though there's no behavior difference from "_isValidSubscript(_:hoistedIsNativeBuffer:)" for a ContiguousArrayBuffer, we want the interface to be interchangeable with the one for the bridgeable ArrayBuffer.

Swift SVN r27409
2015-04-17 05:30:21 +00:00
Joe Groff
836791691e stdlib: Don't build ErrorType bridging helpers if there's no ObjC runtime.
Swift SVN r27406
2015-04-17 05:30:11 +00:00
Joe Groff
99c7f9defc stdlib: Remove #if _runtime guard around ExistentialCollection.
Expose the next layer of issues we need to fix in the non-ObjC build.

Swift SVN r27405
2015-04-17 05:30:08 +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
27155549b7 stdlib: annotate Array.map() and Array.filter() with @noescape
Now these functions are implemented using protocol extensions, which
are, in turn, implemented with an unsafe hack that casts @noescape away.

rdar://20544096

Swift SVN r27397
2015-04-17 02:17:13 +00:00