|
| 1 | +// REQUIRES: objc_interop |
| 2 | + |
| 3 | +// RUN: %empty-directory(%t) |
| 4 | + |
| 5 | +// FIXME: BEGIN -enable-source-import hackaround |
| 6 | +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift -disable-objc-attr-requires-foundation-module |
| 7 | +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift |
| 8 | +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift |
| 9 | +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/AppKit.swift |
| 10 | +// FIXME: END -enable-source-import hackaround |
| 11 | + |
| 12 | + |
| 13 | +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -I %S/Inputs/custom-modules -o %t %s -disable-objc-attr-requires-foundation-module |
| 14 | +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/dynamicself.swiftmodule -typecheck -I %S/Inputs/custom-modules -emit-objc-header-path %t/dynamicself.h -import-objc-header %S/../Inputs/empty.h -disable-objc-attr-requires-foundation-module |
| 15 | +// RUN: %FileCheck %s < %t/dynamicself.h |
| 16 | +// RUN: %check-in-clang -I %S/Inputs/custom-modules/ %t/dynamicself.h |
| 17 | + |
| 18 | +import Foundation |
| 19 | + |
| 20 | +// CHECK-LABEL: @protocol FooProtocol |
| 21 | +@objc protocol FooProtocol { |
| 22 | + // CHECK: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT; |
| 23 | + func fooFunc() -> Self |
| 24 | + // CHECK: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT; |
| 25 | + func optionalFooFunc() -> Self? |
| 26 | +} |
| 27 | +// CHECK: @end |
| 28 | + |
| 29 | +// CHECK-LABEL: @interface BarClass : NSObject <FooProtocol> |
| 30 | +@objc @objcMembers class BarClass: NSObject, FooProtocol { |
| 31 | + // CHECK: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT; |
| 32 | + func fooFunc() -> Self { return self } |
| 33 | + // CHECK: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT; |
| 34 | + func optionalFooFunc() -> Self? { return self } |
| 35 | + // CHECK: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; |
| 36 | +} |
| 37 | +// CHECK: @end |
0 commit comments