|
1 | 1 | // RUN: %empty-directory(%t)
|
2 | 2 | // RUN: %target-build-swift %s -module-name FunctionSignature -emit-module -emit-module-path %t/
|
3 | 3 | // RUN: %target-swift-symbolgraph-extract -module-name FunctionSignature -I %t -pretty-print -output-dir %t
|
4 |
| -// RUN: %FileCheck %s --input-file %t/FunctionSignature.symbols.json |
| 4 | +// RUN: %FileCheck %s --input-file %t/FunctionSignature.symbols.json --check-prefix=FUNC |
| 5 | +// RUN: %FileCheck %s --input-file %t/FunctionSignature.symbols.json --check-prefix=INIT |
| 6 | +// RUN: %FileCheck %s --input-file %t/FunctionSignature.symbols.json --check-prefix=SUBSCRIPT |
5 | 7 |
|
6 |
| -public func foo(_ noext: Int, ext int: Int) -> String { |
7 |
| - return "OK" |
8 |
| -} |
| 8 | +public struct MyStruct { |
| 9 | + public init(_ noext: Int, ext int: Int) {} |
| 10 | + |
| 11 | +// INIT-LABEL: "precise": "s:17FunctionSignature8MyStructV_3extACSi_Sitcfc", |
| 12 | +// INIT: "name": "noext" |
| 13 | +// INIT-NOT: "internalName": "noext" |
| 14 | +// INIT-NEXT: declarationFragments |
| 15 | + |
| 16 | +// INIT: "kind": "identifier" |
| 17 | +// INIT-NEXT: "spelling": "noext" |
| 18 | +// INIT: "kind": "text" |
| 19 | +// INIT-NEXT: "spelling": ": " |
| 20 | +// INIT: "kind": "typeIdentifier" |
| 21 | +// INIT-NEXT: "spelling": "Int" |
| 22 | +// INIT-NEXT: "preciseIdentifier": "s:Si" |
| 23 | + |
| 24 | +// INIT: "name": "ext" |
| 25 | +// INIT-NEXT: "internalName": "int" |
| 26 | +// INIT-NEXT: declarationFragments |
| 27 | + |
| 28 | +// INIT: "kind": "identifier" |
| 29 | +// INIT-NEXT: "spelling": "int" |
| 30 | +// INIT: "kind": "text" |
| 31 | +// INIT-NEXT: "spelling": ": " |
| 32 | +// INIT: "kind": "typeIdentifier" |
| 33 | +// INIT-NEXT: "spelling": "Int" |
| 34 | +// INIT-NEXT: "preciseIdentifier": "s:Si" |
| 35 | + |
| 36 | + public subscript(_ noext: Int, ext int: Int) -> String { |
| 37 | + get { return "OK" } |
| 38 | + set { } |
| 39 | + } |
| 40 | + |
| 41 | +// SUBSCRIPT-LABEL: "precise": "s:17FunctionSignature8MyStructV_3extSSSi_Sitcip", |
| 42 | +// SUBSCRIPT: "name": "noext" |
| 43 | +// SUBSCRIPT-NOT: "internalName": "noext" |
| 44 | +// SUBSCRIPT-NEXT: declarationFragments |
| 45 | + |
| 46 | +// SUBSCRIPT: "kind": "identifier" |
| 47 | +// SUBSCRIPT-NEXT: "spelling": "noext" |
| 48 | +// SUBSCRIPT: "kind": "text" |
| 49 | +// SUBSCRIPT-NEXT: "spelling": ": " |
| 50 | +// SUBSCRIPT: "kind": "typeIdentifier" |
| 51 | +// SUBSCRIPT-NEXT: "spelling": "Int" |
| 52 | +// SUBSCRIPT-NEXT: "preciseIdentifier": "s:Si" |
| 53 | + |
| 54 | +// SUBSCRIPT: "name": "ext" |
| 55 | +// SUBSCRIPT-NEXT: "internalName": "int" |
| 56 | +// SUBSCRIPT-NEXT: declarationFragments |
9 | 57 |
|
10 |
| -// CHECK: "name": "noext" |
11 |
| -// CHECK-NOT: "internalName": "noext" |
12 |
| -// CHECK-NEXT: declarationFragments |
13 |
| - |
14 |
| -// CHECK: "kind": "identifier" |
15 |
| -// CHECK-NEXT: "spelling": "noext" |
16 |
| -// CHECK: "kind": "text" |
17 |
| -// CHECK-NEXT: "spelling": ": " |
18 |
| -// CHECK: "kind": "typeIdentifier" |
19 |
| -// CHECK-NEXT: "spelling": "Int" |
20 |
| -// CHECK-NEXT: "preciseIdentifier": "s:Si" |
21 |
| - |
22 |
| -// CHECK: "name": "ext" |
23 |
| -// CHECK-NEXT: "internalName": "int" |
24 |
| -// CHECK-NEXT: declarationFragments |
25 |
| - |
26 |
| -// CHECK: "kind": "identifier" |
27 |
| -// CHECK-NEXT: "spelling": "int" |
28 |
| -// CHECK: "kind": "text" |
29 |
| -// CHECK-NEXT: "spelling": ": " |
30 |
| -// CHECK: "kind": "typeIdentifier" |
31 |
| -// CHECK-NEXT: "spelling": "Int" |
32 |
| -// CHECK-NEXT: "preciseIdentifier": "s:Si" |
33 |
| - |
34 |
| -// CHECK: returns |
35 |
| -// CHECK: "kind": "typeIdentifier" |
36 |
| -// CHECK-NEXT: "spelling": "String" |
37 |
| -// CHECK-NEXT: "preciseIdentifier": "s:SS" |
| 58 | +// SUBSCRIPT: "kind": "identifier" |
| 59 | +// SUBSCRIPT-NEXT: "spelling": "int" |
| 60 | +// SUBSCRIPT: "kind": "text" |
| 61 | +// SUBSCRIPT-NEXT: "spelling": ": " |
| 62 | +// SUBSCRIPT: "kind": "typeIdentifier" |
| 63 | +// SUBSCRIPT-NEXT: "spelling": "Int" |
| 64 | +// SUBSCRIPT-NEXT: "preciseIdentifier": "s:Si" |
| 65 | + |
| 66 | +// SUBSCRIPT: returns |
| 67 | +// SUBSCRIPT: "kind": "typeIdentifier" |
| 68 | +// SUBSCRIPT-NEXT: "spelling": "String" |
| 69 | +// SUBSCRIPT-NEXT: "preciseIdentifier": "s:SS" |
| 70 | + |
| 71 | + public func foo(_ noext: Int, ext int: Int) -> String { |
| 72 | + return "OK" |
| 73 | + } |
| 74 | + |
| 75 | +// FUNC-LABEL: "precise": "s:17FunctionSignature8MyStructV3foo_3extSSSi_SitF", |
| 76 | +// FUNC: "name": "noext" |
| 77 | +// FUNC-NOT: "internalName": "noext" |
| 78 | +// FUNC-NEXT: declarationFragments |
| 79 | + |
| 80 | +// FUNC: "kind": "identifier" |
| 81 | +// FUNC-NEXT: "spelling": "noext" |
| 82 | +// FUNC: "kind": "text" |
| 83 | +// FUNC-NEXT: "spelling": ": " |
| 84 | +// FUNC: "kind": "typeIdentifier" |
| 85 | +// FUNC-NEXT: "spelling": "Int" |
| 86 | +// FUNC-NEXT: "preciseIdentifier": "s:Si" |
| 87 | + |
| 88 | +// FUNC: "name": "ext" |
| 89 | +// FUNC-NEXT: "internalName": "int" |
| 90 | +// FUNC-NEXT: declarationFragments |
| 91 | + |
| 92 | +// FUNC: "kind": "identifier" |
| 93 | +// FUNC-NEXT: "spelling": "int" |
| 94 | +// FUNC: "kind": "text" |
| 95 | +// FUNC-NEXT: "spelling": ": " |
| 96 | +// FUNC: "kind": "typeIdentifier" |
| 97 | +// FUNC-NEXT: "spelling": "Int" |
| 98 | +// FUNC-NEXT: "preciseIdentifier": "s:Si" |
| 99 | + |
| 100 | +// FUNC: returns |
| 101 | +// FUNC: "kind": "typeIdentifier" |
| 102 | +// FUNC-NEXT: "spelling": "String" |
| 103 | +// FUNC-NEXT: "preciseIdentifier": "s:SS" |
| 104 | + |
| 105 | +} |
0 commit comments