mirror of
https://github.com/apple/swift.git
synced 2025-12-25 12:15:36 +01:00
Provide a general mechanism for bridging from a Swift value type to its corresponding Objective-C class type through the _bridgeToObjectiveC witness of the appropriate _ObjectiveCBridgeable protocol conformance. Only enable this new code for bridging String -> NSString and work through the issues that crop up. We cannot actually *delete* the _convertStringtoNSString entrypoint yet, because there is some code that is depending on it indirectly; I'll address that separately as part of the continued generalization of the _ObjectiveCBridgeable mechanism.
51 lines
1.1 KiB
Swift
51 lines
1.1 KiB
Swift
// RUN: rm -rf %t && mkdir %t
|
|
// RUN: %build-clang-importer-objc-overlays
|
|
|
|
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -emit-sil -I %S/Inputs/custom-modules %s -verify
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import ObjCSubscripts
|
|
|
|
// rdar://problem/19772357
|
|
class KeySubscript1Sub : KeySubscript1 {
|
|
override subscript (str: String!) -> AnyObject! {
|
|
get { return self }
|
|
set { }
|
|
}
|
|
}
|
|
|
|
class KeySubscript2Sub : KeySubscript2 {
|
|
override subscript (str: String) -> AnyObject? {
|
|
get { return self }
|
|
set { }
|
|
}
|
|
}
|
|
|
|
class KeySubscript3Sub : KeySubscript3 {
|
|
override subscript (str: String) -> String? {
|
|
get { return str }
|
|
set { }
|
|
}
|
|
}
|
|
|
|
class KeySubscript4Sub : KeySubscript4 {
|
|
override subscript (str: [AnyObject]) -> String? {
|
|
get { return nil }
|
|
set { }
|
|
}
|
|
}
|
|
|
|
class ConformsToKeySubscriptProto1 : KeySubscriptProto1 {
|
|
@objc subscript (s: String) -> String? {
|
|
return s
|
|
}
|
|
}
|
|
|
|
class ConformsToKeySubscriptProto2 : KeySubscriptProto2 {
|
|
@objc subscript (s: String!) -> String! {
|
|
get { return s }
|
|
set { }
|
|
}
|
|
}
|