mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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
32 lines
918 B
Swift
32 lines
918 B
Swift
// RUN: %target-swift-frontend -sdk %S/../Inputs/objc-generics-sdk -I %S/../Inputs/objc-generics-sdk/swift-modules -enable-source-import -parse -parse-as-library -verify %s
|
|
|
|
// REQUIRES: objc_generics
|
|
|
|
import Foundation
|
|
|
|
func testNSArrayBridging(hive: Hive) {
|
|
let bees: [Bee] = hive.bees
|
|
}
|
|
|
|
func testNSDictionaryBridging(hive: Hive) {
|
|
let beesByName: [String : Bee] = hive.beesByName // expected-error{{value of optional type '[String : Bee]?' not unwrapped;}}
|
|
|
|
var dict1 = hive.anythingToBees
|
|
var dict2: [NSObject : Bee] = dict1
|
|
dict1 = dict2
|
|
}
|
|
|
|
func testNSSetBridging(hive: Hive) {
|
|
let relatedHives: Set<Bee>= hive.allBees
|
|
}
|
|
|
|
public func expectType<T>(_: T.Type, inout _ x: T) {}
|
|
|
|
func testNSMutableDictionarySubscript(
|
|
dict: NSMutableDictionary, key: NSCopying, value: AnyObject) {
|
|
var oldValue = dict[key]
|
|
expectType(ImplicitlyUnwrappedOptional<AnyObject>.self, &oldValue)
|
|
|
|
dict[key] = value
|
|
}
|