Skip to content

Commit f0a4673

Browse files
[SR-12248] Add tests
1 parent ac72855 commit f0a4673

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/decl/protocol/special/coding/struct_codable_simple.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,21 @@ let _ = SimpleStruct.encode(to:)
2929
// The synthesized CodingKeys type should not be accessible from outside the
3030
// struct.
3131
let _ = SimpleStruct.CodingKeys.self // expected-error {{'CodingKeys' is inaccessible due to 'private' protection level}}
32+
33+
// rdar://problem/59655704
34+
struct SR_12248_1: Codable { // expected-error {{type 'SR_12248_1' does not conform to protocol 'Encodable'}}
35+
var x: Int // expected-note {{'x' previously declared here}}
36+
var x: Int // expected-error {{invalid redeclaration of 'x'}}
37+
// expected-note@-1 {{cannot automatically synthesize 'Encodable' because '<<error type>>' does not conform to 'Encodable'}}
38+
// expected-note@-2 {{cannot automatically synthesize 'Encodable' because '<<error type>>' does not conform to 'Encodable'}}
39+
}
40+
41+
struct SR_12248_2: Decodable {
42+
var x: Int // expected-note {{'x' previously declared here}}
43+
var x: Int // expected-error {{invalid redeclaration of 'x'}}
44+
}
45+
46+
struct SR_12248_3: Encodable {
47+
var x: Int // expected-note {{'x' previously declared here}}
48+
var x: Int // expected-error {{invalid redeclaration of 'x'}}
49+
}

0 commit comments

Comments
 (0)