In iOS 8.0/OS X 10.10, SpriteKit introduced an
-objectForKeyedSubscript: method that enabled subscripting in
Objective-C. However, this subscript wasn't generally useful in Swift
because it took AnyObject and produced AnyObject, so the SpriteKit
overlay defined a subscript that took a String and produced an
[SKNode].
Subsequently, in iOS 9.0/OS X 10.10, -objectForKeyedSubscript: got
type annotations that gave it the appropriate Swift signature, which
made the subscript defined in the overlay redundant.
The twisty logic of the Clang importer would suppress the imported
subscript when it saw the one in the overlay, hiding the
redundancy. My cleanup of that logic in
0c0a0fab4b caused uses of the subscript
to be redundant.
Removal of the redundant code in the overlay is the overall best
answer, because it minimizes the size of the overlay and leaves the
API in the Objective-C header. However, this will introduce a
regression for SpriteKit applications targeting iOS 7.0/OS X 10.8,
where the overlay was compensating for the lack of this operation
before iOS 8.0 / OS X 10.8. There are workarounds here we can
investigate, although they're fairly hacky.
At some point I want to propose a revised model for exports, but for now
just mark that support for '@exported' is still experimental and subject
to change. (Thanks, Max.)
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
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
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.
See stdlib/{public,internal,private}/README.txt for more information.
Swift SVN r25876