Commit Graph

5263 Commits

Author SHA1 Message Date
Dmitri Hrybenko
b05c372c4f stdlib: change sort() and sorted() into methods
Swift SVN r27876
2015-04-28 18:05:37 +00:00
Dmitri Hrybenko
ff6f084b77 tests: remove -disable-access-control from Sort.swift.gyb
Swift SVN r27859
2015-04-28 04:40:59 +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
0ef360228b stdlib: constrain CollectionType.SubSlice to _CollectionDefaultsType
The language has limitations that don't allow us to express the API we
actually want, and we have to resort to underscored protocols again.

<rdar://problem/20715009> Implement recursive protocol constraints

<rdar://problem/20477576> 'where' constraints on associated types in
protocols

Swift SVN r27820
2015-04-27 21:50:19 +00:00
Dmitri Hrybenko
6e68fd7675 stdlib: remove a FIXME that is fixed now
Swift SVN r27816
2015-04-27 19:59:17 +00:00
Dave Abrahams
e2c6c7e90d [stdlib] Fix "#" parameter warnings due to new rules
Swift SVN r27807
2015-04-27 18:15:34 +00:00
Dmitri Hrybenko
3408c00886 stdlib: fix a typo in a trap message
Swift SVN r27796
2015-04-27 01:09:33 +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
80dc495ad0 stdlib: fix coding style in HashedCollections
Swift SVN r27735
2015-04-26 00:08:14 +00:00
Dmitri Hrybenko
44ef30a5af stdlib: fix grammar in an error message
Swift SVN r27734
2015-04-26 00:08:13 +00:00
Dmitri Hrybenko
3a59a446ac stdlib: adjust _NSSetCoreType to match Foundation nullability audit
Swift SVN r27730
2015-04-26 00:08:11 +00:00
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