@@ -13,7 +13,7 @@ func baz() {
13
13
bar ( a: " hello, world! " )
14
14
}
15
15
16
- struct Foo : Codable {
16
+ struct Foo {
17
17
var x : Int
18
18
var x : Int
19
19
}
@@ -39,6 +39,10 @@ let x = {
39
39
return y
40
40
}
41
41
42
+ struct B: Decodable {
43
+ let a: Foo
44
+ }
45
+
42
46
// Test fallback for non-ASCII characters.
43
47
// CHECK: SOURCE_DIR/test/diagnostics/pretty-printed-diagnostics.swift:35:11
44
48
// CHECK: 34 |
@@ -64,34 +68,13 @@ let x = {
64
68
65
69
66
70
// CHECK: SOURCE_DIR/test/diagnostics/pretty-printed-diagnostics.swift:18:7
67
- // CHECK: 16 | struct Foo: Codable {
71
+ // CHECK: 16 | struct Foo {
68
72
// CHECK: 17 | var x: Int
69
73
// CHECK: | ^ note: 'x' previously declared here
70
74
// CHECK: 18 | var x: Int
71
75
// CHECK: | ^ error: invalid redeclaration of 'x'
72
76
// CHECK: 19 | }
73
77
74
- // Test fallback for invalid locations.
75
- // CHECK: Unknown Location
76
- // CHECK: | error: invalid redeclaration of 'x'
77
- // CHECK: | note: 'x' previously declared here
78
-
79
- // Test cross-file and decl anchored diagnostics.
80
- // CHECK: SOURCE_DIR/test/diagnostics/pretty-printed-diagnostics.swift:16:8
81
- // CHECK: 15 |
82
- // CHECK: 16 | struct Foo: Codable {
83
- // CHECK: | ^ error: type 'Foo' does not conform to protocol 'Encodable'
84
- // CHECK: 17 | var x: Int
85
- // CHECK: 18 | var x: Int
86
- // CHECK: | ^ note: cannot automatically synthesize 'Encodable' because
87
- // CHECK: | ^ note: cannot automatically synthesize 'Encodable' because
88
- // CHECK: 19 | }
89
- // CHECK: Swift.Encodable:2:10
90
- // CHECK: 1 | public protocol Encodable {
91
- // CHECK: 2 | func encode(to encoder: Encoder) throws
92
- // CHECK: | ^ note: protocol requires function 'encode(to:)' with type 'Encodable'
93
- // CHECK: 3 | }
94
-
95
78
// Test out-of-line fix-its on notes.
96
79
// CHECK: SOURCE_DIR/test/diagnostics/pretty-printed-diagnostics.swift:28:1
97
80
// CHECK: 27 | }
@@ -125,6 +108,19 @@ let x = {
125
108
// CHECK: | ^ error: unable to infer complex closure return type; add explicit type to disambiguate
126
109
// CHECK: 38 | let y = 1
127
110
111
+ // CHECK: SOURCE_DIR/test/diagnostics/pretty-printed-diagnostics.swift:42:8
112
+ // CHECK: 41 |
113
+ // CHECK: 42 | struct B: Decodable {
114
+ // CHECK: | ^ error: type 'B' does not conform to protocol 'Decodable'
115
+ // CHECK: 43 | let a: Foo
116
+ // CHECK: | ^ note: cannot automatically synthesize 'Decodable' because 'Foo' does not conform to 'Decodable'
117
+ // CHECK: 44 | }
118
+ // CHECK: Swift.Decodable:2:5
119
+ // CHECK: 1 | public protocol Decodable {
120
+ // CHECK: 2 | init(from decoder: Decoder) throws
121
+ // CHECK: | ^ note: protocol requires initializer 'init(from:)' with type 'Decodable'
122
+ // CHECK: 3 | }
123
+
128
124
// CHECK: SOURCE_DIR/test/diagnostics/pretty-printed-diagnostics.swift:6:5
129
125
// CHECK: 5 | func foo(a: Int, b: Int) {
130
126
// CHECK: 6 | a + b
0 commit comments