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.
Most of this is in updating the standard library, SDK overlays, and
piles of test cases to use the new names. No surprises here, although
this shows us some potential heuristic tweaks.
There is one substantive compiler change that needs to be factored out
involving synthesizing calls to copyWithZone()/copy(zone:). Aside from
that, there are four failing tests:
Swift :: ClangModules/objc_parse.swift
Swift :: Interpreter/SDK/Foundation_test.swift
Swift :: Interpreter/SDK/archiving_generic_swift_class.swift
Swift :: Interpreter/SDK/objc_currying.swift
due to two independent remaining compiler bugs:
* We're not getting partial ordering between NSCoder's
encode(AnyObject, forKey: String) and NSKeyedArchiver's version of
that method, and
* Dynamic lookup (into AnyObject) doesn't know how to find the new
names. We need the Swift name lookup tables enabled to address this.
This decreases total testing time by over a minute on my old Mac Pro.
It probably has much less effect on systems with fewer cores, but shouldn't
be any worse there.
Swift SVN r22745