Skip to content

Commit 51183c2

Browse files
committed
[Test] Update existing tests
1 parent 9676d66 commit 51183c2

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

test/Sema/enum_conformance_synthesis.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func customHashable() {
6161
enum InvalidCustomHashable {
6262
case A, B
6363

64-
var hashValue: String { return "" }
64+
var hashValue: String { return "" } // expected-error {{invalid redeclaration of synthesized witness for protocol requirement 'hashValue'}}
6565
}
6666
func ==(x: InvalidCustomHashable, y: InvalidCustomHashable) -> String {
6767
return ""
@@ -369,7 +369,6 @@ func canEatHotChip(_ birthyear:Birthyear) -> Bool {
369369
return birthyear > .nineties(3)
370370
}
371371
// FIXME: Remove -verify-ignore-unknown.
372-
// <unknown>:0: error: unexpected error produced: invalid redeclaration of 'hashValue'
373372
// <unknown>:0: error: unexpected note produced: candidate has non-matching type '(Foo, Foo) -> Bool'
374373
// <unknown>:0: error: unexpected note produced: candidate has non-matching type '<T> (Generic<T>, Generic<T>) -> Bool'
375374
// <unknown>:0: error: unexpected note produced: candidate has non-matching type '(InvalidCustomHashable, InvalidCustomHashable) -> Bool'

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,24 @@ let _ = SimpleStruct.encode(to:)
3131
let _ = SimpleStruct.CodingKeys.self // expected-error {{'CodingKeys' is inaccessible due to 'private' protection level}}
3232

3333
// rdar://problem/59655704
34-
struct SR_12248_1: Codable { // expected-error {{type 'SR_12248_1' does not conform to protocol 'Encodable'}}
34+
struct SR_12248_1: Codable {
35+
// expected-error@-1 {{type 'SR_12248_1' does not conform to protocol 'Encodable'}}
36+
// expected-error@-2 {{invalid redeclaration of synthesized enum case 'x'}}
37+
3538
var x: Int // expected-note {{'x' previously declared here}}
3639
var x: Int // expected-error {{invalid redeclaration of 'x'}}
3740
// expected-note@-1 {{cannot automatically synthesize 'Encodable' because '<<error type>>' does not conform to 'Encodable'}}
3841
// expected-note@-2 {{cannot automatically synthesize 'Encodable' because '<<error type>>' does not conform to 'Encodable'}}
3942
}
4043

41-
struct SR_12248_2: Decodable {
44+
struct SR_12248_2: Decodable {
45+
// expected-error@-1 {{invalid redeclaration of synthesized enum case 'x'}}
4246
var x: Int // expected-note {{'x' previously declared here}}
4347
var x: Int // expected-error {{invalid redeclaration of 'x'}}
4448
}
4549

46-
struct SR_12248_3: Encodable {
50+
struct SR_12248_3: Encodable {
51+
// expected-error@-1 {{invalid redeclaration of synthesized enum case 'x'}}
4752
var x: Int // expected-note {{'x' previously declared here}}
4853
var x: Int // expected-error {{invalid redeclaration of 'x'}}
4954
}

test/decl/var/property_wrappers.swift

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,13 +849,30 @@ struct WrapperWithProjectedValue<T> {
849849
var projectedValue: T { return wrappedValue }
850850
}
851851

852-
class TestInvalidRedeclaration {
852+
class TestInvalidRedeclaration1 {
853+
// expected-error@-1 {{invalid redeclaration of synthesized property '_i'}}
854+
// expected-error@-2 {{invalid redeclaration of synthesized property '$i'}}
855+
853856
@WrapperWithProjectedValue var i = 17
854857
// expected-note@-1 {{'i' previously declared here}}
858+
// expected-note@-2 {{'$i' synthesized for property wrapper projected value}}
859+
// expected-note@-3 {{'_i' synthesized for property wrapper backing storage}}
860+
855861
@WrapperWithProjectedValue var i = 39
856862
// expected-error@-1 {{invalid redeclaration of 'i'}}
857863
}
858864

865+
// SR-12839
866+
struct TestInvalidRedeclaration2 {
867+
var _foo1 = 123 // expected-error {{invalid redeclaration of synthesized property '_foo1'}}
868+
@WrapperWithInitialValue var foo1 = 123 // expected-note {{'_foo1' synthesized for property wrapper backing storage}}
869+
}
870+
871+
struct TestInvalidRedeclaration3 {
872+
@WrapperWithInitialValue var foo1 = 123 // expected-note {{'_foo1' synthesized for property wrapper backing storage}}
873+
var _foo1 = 123 // expected-error {{invalid redeclaration of synthesized property '_foo1'}}
874+
}
875+
859876
// ---------------------------------------------------------------------------
860877
// Closures in initializers
861878
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)