forked from swiftlang/swift
- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtractInjectOptional.swift
35 lines (30 loc) · 1007 Bytes
/
ExtractInjectOptional.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// RUN: %empty-directory(%t)
// RUN: echo "[MyProto]" > %t/protocols.json
// RUN: %target-swift-frontend -typecheck -emit-const-values-path %t/ExtractLiterals.swiftconstvalues -const-gather-protocols-file %t/protocols.json -primary-file %s
// RUN: cat %t/ExtractLiterals.swiftconstvalues 2>&1 | %FileCheck %s
protocolMyProto{}
structInjectablePropertyStruct:MyProto{
letinit1=Bat(buz:"hello", fuz:4)
}
publicstructBat{
letbuz:String?
letfuz:Int
init(buz:String?="", fuz:Int=0){
self.buz = buz
self.fuz = fuz
}
}
// CHECK: "arguments": [
// CHECK-NEXT: {
// CHECK-NEXT: "label": "buz",
// CHECK-NEXT: "type": "Swift.Optional<Swift.String>",
// CHECK-NEXT: "valueKind": "RawLiteral",
// CHECK-NEXT: "value": "hello"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "label": "fuz",
// CHECK-NEXT: "type": "Swift.Int",
// CHECK-NEXT: "valueKind": "RawLiteral",
// CHECK-NEXT: "value": "4"
// CHECK-NEXT: }
// CHECK-NEXT: ]