Skip to content

Commit 257a51e

Browse files
committed
Update test for improved require initializer checking
1 parent 428d718 commit 257a51e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class DecodableSuper : Decodable {
6363

6464
// expected-note@+1 {{did you mean to override 'init(from:)'?}}{{+1:1-1=\noverride init(from decoder: Decoder) throws {\n <#code#>\n\}}}
6565
class DecodableSubWithoutInitialValue : DecodableSuper { // expected-error {{class 'DecodableSubWithoutInitialValue' has no initializers}}
66+
// expected-warning{{'required' initializer 'init(from:)' must be provided by subclass of 'DecodableSuper'}}
6667
var value2: Int // expected-note {{stored property 'value2' without initial value prevents synthesized initializers}}
6768
}
6869

@@ -78,6 +79,7 @@ class CodableSuper : Codable {
7879

7980
// expected-note@+1 {{did you mean to override 'init(from:)' and 'encode(to:)'?}}{{+1:1-1=\noverride init(from decoder: Decoder) throws {\n <#code#>\n\}\n\noverride func encode(to encoder: Encoder) throws {\n <#code#>\n\}}}
8081
class CodableSubWithoutInitialValue : CodableSuper { // expected-error {{class 'CodableSubWithoutInitialValue' has no initializers}}
82+
// expected-warning{{'required' initializer 'init(from:)' must be provided by subclass of 'CodableSuper'; this is an error in Swift 6}}
8183
var value2: Int // expected-note {{stored property 'value2' without initial value prevents synthesized initializers}}
8284
}
8385

@@ -86,6 +88,7 @@ class CodableSubWithoutInitialValue : CodableSuper { // expected-error {{class '
8688
//
8789
// expected-note@+1 {{did you mean to override 'init(from:)'?}}{{+1:1-1=\noverride init(from decoder: Decoder) throws {\n <#code#>\n\}}}
8890
class EncodableSubWithoutInitialValue : CodableSuper { // expected-error {{class 'EncodableSubWithoutInitialValue' has no initializers}}
91+
// expected-warning{{'required' initializer 'init(from:)' must be provided by subclass of 'CodableSuper'; this is an error in Swift 6}}
8992
var value2: Int // expected-note {{stored property 'value2' without initial value prevents synthesized initializers}}
9093

9194
override func encode(to: Encoder) throws {}

0 commit comments

Comments
 (0)