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
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
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
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
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
This allows array types to get the best performance. The default
implementation for range replaceable collections appends elements one by
one, and the optimizer can't hoist uniqueness checks from the loop in
that case yet.
Swift SVN r27314
Array(other_collection) is using an optimized code path for copying
collections. An explicit for loop does not.
This commit should recover the performance regression in
rdar://20530390.
Swift SVN r27313