File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,11 @@ static std::shared_ptr<CompileTimeValue> extractCompileTimeValue(Expr *expr) {
306
306
return std::make_shared<TypeValue>(dotSelfExpr->getType ());
307
307
}
308
308
309
+ case ExprKind::UnderlyingToOpaque: {
310
+ auto underlyingToOpaque = cast<UnderlyingToOpaqueExpr>(expr);
311
+ return extractCompileTimeValue (underlyingToOpaque->getSubExpr ());
312
+ }
313
+
309
314
default : {
310
315
break ;
311
316
}
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: echo "[MyProto]" > %t/protocols.json
3
+
4
+ // RUN: %target-swift-frontend -typecheck -emit-const-values-path %t/ExtractLiterals.swiftconstvalues -const-gather-protocols-file %t/protocols.json -primary-file %s
5
+ // RUN: cat %t/ExtractLiterals.swiftconstvalues 2>&1 | %FileCheck %s
6
+
7
+ protocol MyProto { }
8
+ protocol Bird { }
9
+ struct UnderlyingToOpaquePropertyStruct : MyProto {
10
+ var warbler : some Bird {
11
+ Warbler ( " blue " )
12
+ }
13
+ }
14
+
15
+ public struct Warbler : Bird {
16
+ let belly : String = " yellow "
17
+ init ( _ color: String = " red " ) {
18
+ self . belly = color
19
+ }
20
+ }
21
+
22
+ // CHECK: "valueKind": "InitCall",
23
+ // CHECK-NEXT: "value": {
24
+ // CHECK-NEXT: "type": "ExtractUnderlyingToOpaque.Warbler",
25
+ // CHECK-NEXT: "arguments": [
26
+ // CHECK-NEXT: {
27
+ // CHECK-NEXT: "label": "",
28
+ // CHECK-NEXT: "type": "Swift.String",
29
+ // CHECK-NEXT: "valueKind": "RawLiteral",
30
+ // CHECK-NEXT: "value": "blue"
31
+ // CHECK-NEXT: }
32
+ // CHECK-NEXT: ]
33
+ // CHECK-NEXT: }
You can’t perform that action at this time.
0 commit comments