Files
swift-mirror/test/ModuleInterface/ObjC.swiftinterface
Jordan Rose c66fcf2e61 [SILGen] Don't SILGen an @objc entry point for a deinit with no body (#19472)
In general we'll want to investigate what we are and aren't SILGen-ing
for textual interfaces of resilient modules, but for fragile modules
we may as well generate everything we can for potential optimization
purposes.
2018-09-28 13:17:47 -07:00

60 lines
1.6 KiB
Plaintext

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t/ObjC.swiftmodule -O -enable-objc-interop %s
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t/ObjC.swiftmodule -O -enable-objc-interop -enable-resilience %s
// FIXME: This test is self-contained, so it shouldn't require objc_interop
// (just -enable-objc-interop), but it's failing in Linux SILGen.
// https://bugs.swift.org/browse/SR-8877
// REQUIRES: objc_interop
import Foundation
public class SomeClass {
@objc init?(_: Any)
@objc func foo()
@objc var bar: Int { get set }
@objc subscript(_: Int) -> Int { get set }
@objc deinit
}
public class SomeClassInlinable {
@usableFromInline init()
@objc @inlinable convenience init?(_: Any) { self.init() }
@objc @inlinable func foo() {}
@objc var bar: Int {
@inlinable get { return 0 }
@inlinable set {}
}
@objc @inlinable subscript(_: Int) -> Int {
@inlinable get { return 0 }
@inlinable set {}
}
@objc @inlinable deinit {
print("bye")
}
}
public class SomeNSObject : NSObject {
@objc init?(_: Any)
@objc func foo()
@objc var bar: Int { get set }
@objc subscript(_: Int) -> Int { get set }
@objc deinit
}
public class SomeNSObjectInlinable : NSObject {
public override init()
@objc @inlinable convenience init?(_: Any) { self.init() }
@objc @inlinable func foo() {}
@objc var bar: Int {
@inlinable get { return 0 }
@inlinable set {}
}
@objc @inlinable subscript(_: Int) -> Int {
@inlinable get { return 0 }
@inlinable set {}
}
@objc @inlinable deinit {
print("bye")
}
}