6
6
7
7
// RUN: %swift-module-summary-test --to-yaml %t/type_refs.swiftmodule.summary -o %t/type_refs.summary.yaml
8
8
9
- // Ensure that type reference to S is recorded
9
+ // Ensure that type reference to S, C and D are recorded
10
10
// RUN: cat %t/type_refs.summary.yaml | %FileCheck %s -check-prefix SIMPLE-COERCE
11
11
12
+ // SIMPLE-COERCE: name: '$s9type_refs11coerceToAnyyypAA1DCF'
13
+ // SIMPLE-COERCE-NEXT: guid: 14079990488171131
14
+ // SIMPLE-COERCE-NEXT: live: false
15
+ // SIMPLE-COERCE-NEXT: preserved: false
16
+ // SIMPLE-COERCE-NEXT: calls: []
17
+ // SIMPLE-COERCE-NEXT: type_refs:
18
+ // SIMPLE-COERCE-NEXT: - name: 9type_refs1DC
19
+ // SIMPLE-COERCE-NEXT: guid: 1332210649212571009
20
+
21
+ // SIMPLE-COERCE: name: '$s9type_refs11coerceToAnyyypAA1CCF'
22
+ // SIMPLE-COERCE-NEXT: guid: 1940219073901329473
23
+ // SIMPLE-COERCE-NEXT: live: false
24
+ // SIMPLE-COERCE-NEXT: preserved: false
25
+ // SIMPLE-COERCE-NEXT: calls: []
26
+ // SIMPLE-COERCE-NEXT: type_refs:
27
+ // SIMPLE-COERCE-NEXT: - name: 9type_refs1CC
28
+ // SIMPLE-COERCE-NEXT: guid: 14053292587484144632
29
+
12
30
// SIMPLE-COERCE: name: '$s9type_refs9coerceToPyAA1P_pAA1SVF'
13
- // SIMPLE-COERCE-NEXT: guid: 15452386893050095333
14
- // SIMPLE-COERCE-NEXT: live: false
15
- // SIMPLE-COERCE-NEXT: preserved: false
16
- // SIMPLE-COERCE-NEXT: calls: []
17
- // SIMPLE-COERCE-NEXT: type_refs:
18
- // SIMPLE-COERCE-NEXT: - name: 9type_refs1SV
19
- // SIMPLE-COERCE-NEXT: guid: 12736589225588998764
31
+ // SIMPLE-COERCE-NEXT: guid: 15452386893050095333
32
+ // SIMPLE-COERCE-NEXT: live: false
33
+ // SIMPLE-COERCE-NEXT: preserved: false
34
+ // SIMPLE-COERCE-NEXT: calls: []
35
+ // SIMPLE-COERCE-NEXT: type_refs:
36
+ // SIMPLE-COERCE-NEXT: - name: 9type_refs1SV
37
+ // SIMPLE-COERCE-NEXT: guid: 12736589225588998764
38
+
39
+
40
+
41
+ // Ensure that witness impl of S.foo for P has type ref to S
42
+ // RUN: cat %t/type_refs.summary.yaml | %FileCheck %s -check-prefix WITNESS-IMPL
43
+
44
+ // WITNESS-IMPL: 12925277474523063582:
45
+ // WITNESS-IMPL-NEXT: name: '$s9type_refs1SVAA1PA2aDP3fooyyFTW'
46
+
47
+ // WITNESS-IMPL: witness_tables:
48
+ // WITNESS-IMPL-NEXT: 17891631795932606560:
49
+ // WITNESS-IMPL-NEXT: - guid: 12925277474523063582
50
+ // WITNESS-IMPL-NEXT: type_guid: 12736589225588998764
51
+
52
+
53
+ // Ensure that vtable impl of C.bar and D.bar have type ref to C
54
+ // RUN: cat %t/type_refs.summary.yaml | %FileCheck %s -check-prefix WITNESS-IMPL
55
+
56
+
57
+ // VTABLE-IMPL: 14897920476774525675:
58
+ // VTABLE-IMPL-NEXT: name: '$s9type_refs1CC3baryyF'
59
+ // VTABLE-IMPL: 16977749031506698911:
60
+ // VTABLE-IMPL-NEXT: name: '$s9type_refs1DC3baryyF'
61
+
62
+ // VTABLE-IMPL: 14897920476774525675:
63
+ // VTABLE-IMPL-NEXT: - guid: 14897920476774525675
64
+ // VTABLE-IMPL-NEXT: type_guid: 14053292587484144632
65
+ // VTABLE-IMPL-NEXT: - guid: 16977749031506698911
66
+ // VTABLE-IMPL-NEXT: type_guid: 1332210649212571009
20
67
21
68
22
69
// RUN: %swift_frontend_plain -cross-module-opt %t/type_refs.swiftmodule.summary -module-summary-embed-debug-name -o %t/type_refs.swiftmodule.merged-summary
@@ -38,6 +85,17 @@ struct V : P {
38
85
func foo( ) { }
39
86
}
40
87
88
+ class C {
89
+ func bar( ) { }
90
+ }
91
+
92
+ class D : C {
93
+ override func bar( ) { }
94
+ }
95
+
41
96
func coerceToP( _ x: S ) -> P { return x }
42
97
43
98
_ = coerceToP ( S ( ) )
99
+
100
+ func coerceToAny( _ x: C ) -> Any { return x }
101
+ func coerceToAny( _ x: D ) -> Any { return x }
0 commit comments