File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t %s -module-name dynamicself -disable-objc-attr-requires-foundation-module
3
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/dynamicself.swiftmodule -typecheck -emit-objc-header-path %t/dynamicself.h -disable-objc-attr-requires-foundation-module
4
+ // RUN: %FileCheck %s < %t/dynamicself.h
5
+ // RUN: %check-in-clang %t/dynamicself.h
6
+
7
+ // REQUIRES: objc_interop
8
+
9
+ import Foundation
10
+
11
+ // CHECK-LABEL: @protocol FooProtocol
12
+ // CHECK-NEXT: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT;
13
+ // CHECK-NEXT: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT;
14
+ // CHECK-NEXT: @end
15
+
16
+ @objc protocol FooProtocol {
17
+ func fooFunc( ) -> Self
18
+ func optionalFooFunc( ) -> Self ?
19
+ }
20
+
21
+ // CHECK-LABEL: @interface BarClass : NSObject <FooProtocol>
22
+ // CHECK-NEXT: - (nonnull instancetype)fooFunc SWIFT_WARN_UNUSED_RESULT;
23
+ // CHECK-NEXT: - (nullable instancetype)optionalFooFunc SWIFT_WARN_UNUSED_RESULT;
24
+ // CHECK-NEXT: - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
25
+ // CHECK-NEXT: @end
26
+
27
+ @objc @objcMembers class BarClass : NSObject , FooProtocol {
28
+ func fooFunc( ) -> Self { return self }
29
+ func optionalFooFunc( ) -> Self ? { return self }
30
+ }
You can’t perform that action at this time.
0 commit comments