File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ @protocol TrunkBranchProtocol;
2
+
3
+ __attribute__ ((objc_root_class))
4
+ @interface Trunk
5
+ - (instancetype )init;
6
+ - (void )addLimb:(id <TrunkBranchProtocol>)limb;
7
+ @end
8
+
9
+ // NS_SWIFT_NAME(Trunk.Branch)
10
+ __attribute__ ((swift_name(" Trunk.Branch" )))
11
+ @protocol TrunkBranchProtocol
12
+ - (void ) flower;
13
+ @end
14
+
Original file line number Diff line number Diff line change
1
+ // REQUIRES: objc_interop
2
+
3
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-objc-interop -import-objc-header %S/Inputs/nested_protocol_name.h -typecheck -verify %s
4
+
5
+ // RUN: echo '#include "nested_protocol_name.h"' > %t.m
6
+ // RUN: %target-swift-ide-test -source-filename %s -print-header -header-to-print %S/Inputs/nested_protocol_name.h -import-objc-header %S/Inputs/nested_protocol_name.h -print-regular-comments --cc-args %target-cc-options -fsyntax-only %t.m -I %S/Inputs > %t.txt
7
+ // RUN: %FileCheck -check-prefix=HEADER %s < %t.txt
8
+
9
+ // rdar://59431058
10
+ // Let's make sure this works, but let's not encourage its spread...
11
+
12
+ // HEADER: class Trunk {
13
+ // HEADER: init!()
14
+ // HEADER: class func addLimb(_ limb: Branch!)
15
+ // HEADER: func addLimb(_ limb: Branch!)
16
+ // HEADER: }
17
+ // HEADER: // NS_SWIFT_NAME(Trunk.Branch)
18
+ // HEADER: protocol Branch {
19
+ // HEADER: func flower()
20
+ // HEADER: }
21
+
22
+ func grow( _ branch: Trunk . Branch , from trunk: Trunk ) {
23
+ branch. flower ( )
24
+ trunk. addLimb ( branch)
25
+ }
26
+
27
+ class SturdyBranch : Trunk . Branch {
28
+ func flower( ) { }
29
+ }
30
+
31
+ // FIXME: Odd that name lookup can't find this...
32
+ class NormalBranch : Branch { // expected-error {{use of undeclared type 'Branch'}}
33
+ func flower( ) { }
34
+ }
35
+
36
+ class WeakBranch : TrunkBranchProtocol { // expected-error {{'TrunkBranchProtocol' has been renamed to 'Trunk.Branch'}}
37
+ func flower( ) { }
38
+ }
You can’t perform that action at this time.
0 commit comments