mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This is enough to let the test case in rdar://problem/40899824 pass, and any callers of this function already need to be able to handle a nullptr result. There's a lot more work to do in this area, but it's nice to get the simple things working again.
39 lines
1.0 KiB
Swift
39 lines
1.0 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %s -emit-module -o %t/Library.swiftmodule -I %S/Inputs/custom-modules -DLIBRARY -Xfrontend -enable-objc-interop -Xfrontend -disable-objc-attr-requires-foundation-module
|
|
// RUN: %target-swift-frontend %s -I %t -I %S/Inputs/custom-modules -enable-objc-interop -emit-ir > /dev/null
|
|
|
|
// RUN: %target-swift-frontend %s -I %t -I %S/Inputs/custom-modules -enable-objc-interop -emit-ir -Xcc -DBAD > /dev/null
|
|
// RUN: %target-swift-frontend %s -I %t -I %S/Inputs/custom-modules -enable-objc-interop -emit-ir -Xcc -DBAD -O > /dev/null
|
|
|
|
#if LIBRARY
|
|
|
|
import rdar40899824Helper
|
|
|
|
public protocol Proto: class {
|
|
func use(_: SoonToBeMissing)
|
|
func unrelated()
|
|
}
|
|
|
|
extension Impl: Proto {}
|
|
|
|
#else // LIBRARY
|
|
|
|
import Library
|
|
import rdar40899824Helper
|
|
|
|
func testGeneric<T: Proto>(_ obj: T) {
|
|
obj.unrelated()
|
|
}
|
|
|
|
func testExistential(_ obj: Proto) {
|
|
obj.unrelated()
|
|
}
|
|
|
|
func test(_ proto: Proto, _ impl: Impl) {
|
|
impl.unrelated()
|
|
testGeneric(impl)
|
|
testExistential(impl)
|
|
}
|
|
|
|
#endif // LIBRARY
|