|
| 1 | +// RUN: %target-swift-ide-test -print-indexed-symbols -source-filename %s | %FileCheck %s |
| 2 | + |
| 3 | +struct Foo { // CHECK: [[@LINE]]:8 | struct/Swift | Foo | [[Foo_USR:.*]] | Def | rel: 0 |
| 4 | + init() {} // CHECK: [[@LINE]]:3 | constructor/Swift | init() | [[Foo_init_USR:.*]] | Def,RelChild | rel: 1 |
| 5 | + |
| 6 | + static func bar() -> Self { |
| 7 | + .init() // CHECK: [[@LINE]]:6 | constructor/Swift | init() | [[Foo_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 8 | + } |
| 9 | + |
| 10 | + static func baz() -> Self { |
| 11 | + Self() |
| 12 | + // CHECK: [[@LINE-1]]:5 | struct/Swift | Foo | [[Foo_USR]] | Ref,Impl,RelCont | rel: 1 |
| 13 | + // CHECK: [[@LINE-2]]:5 | constructor/Swift | init() | [[Foo_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +final class Final { // CHECK: [[@LINE]]:13 | class/Swift | Final | [[Final_USR:.*]] | Def | rel: 0 |
| 18 | + init() {} // CHECK: [[@LINE]]:3 | constructor/Swift | init() | [[Final_init_USR:.*]] | Def,RelChild | rel: 1 |
| 19 | + |
| 20 | + static func foo() -> Self { |
| 21 | + .init() // CHECK: [[@LINE]]:6 | constructor/Swift | init() | [[Final_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 22 | + } |
| 23 | + |
| 24 | + static func baz() -> Self { |
| 25 | + Self() |
| 26 | + // CHECK: [[@LINE-1]]:5 | class/Swift | Final | [[Final_USR]] | Ref,Impl,RelCont | rel: 1 |
| 27 | + // CHECK: [[@LINE-2]]:5 | constructor/Swift | init() | [[Final_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +class Bar { // CHECK: [[@LINE]]:7 | class/Swift | Bar | [[Bar_USR:.*]] | Def | rel: 0 |
| 32 | + required init() {} // CHECK: [[@LINE]]:12 | constructor/Swift | init() | [[Bar_init_USR:.*]] | Def,RelChild | rel: 1 |
| 33 | + |
| 34 | + static func foo() -> Self { |
| 35 | + .init() // CHECK: [[@LINE]]:6 | constructor/Swift | init() | [[Bar_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 36 | + } |
| 37 | + |
| 38 | + static func baz() -> Self { |
| 39 | + Self() |
| 40 | + // CHECK: [[@LINE-1]]:5 | class/Swift | Bar | [[Bar_USR]] | Ref,Impl,RelCont | rel: 1 |
| 41 | + // TODO: This reference should be dynamic |
| 42 | + // CHECK: [[@LINE-3]]:5 | constructor/Swift | init() | [[Bar_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +class Baz: Bar {} |
| 47 | + |
| 48 | +protocol Proto { // CHECK: [[@LINE]]:10 | protocol/Swift | Proto | [[Proto_USR:.*]] | Def | rel: 0 |
| 49 | + init() // CHECK: [[@LINE]]:3 | constructor/Swift | init() | [[Proto_init_USR:.*]] | Def,RelChild | rel: 1 |
| 50 | +} |
| 51 | + |
| 52 | +extension Proto { |
| 53 | + func foo() -> Self { |
| 54 | + // TODO: This reference should be dynamic |
| 55 | + Self() // CHECK: [[@LINE]]:5 | constructor/Swift | init() | [[Proto_init_USR]] | Ref,Call,RelCall,RelCont | rel: 1 |
| 56 | + } |
| 57 | +} |
0 commit comments