Skip to content

Commit baf2e4e

Browse files
authored
Merge pull request #22582 from DougGregor/enum-raw-value-error-cascade
2 parents e83974d + 5757d14 commit baf2e4e

File tree

4 files changed

+1
-5
lines changed

4 files changed

+1
-5
lines changed

lib/AST/ProtocolConformance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ void NominalTypeDecl::prepareConformanceTable() const {
13181318
}
13191319

13201320
// Enumerations with a raw type conform to RawRepresentable.
1321-
if (theEnum->hasRawType()) {
1321+
if (theEnum->hasRawType() && !theEnum->getRawType()->hasError()) {
13221322
addSynthesized(KnownProtocolKind::RawRepresentable);
13231323
}
13241324
}

test/IDE/print_ast_tc_decls_errors.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,10 @@ class ClassWithInheritance9 : FooClass, BarClass, FooProtocol, BarProtocol, FooN
110110
//===---
111111

112112
enum EnumWithInheritance1 : FooNonExistentProtocol {} // expected-error {{use of undeclared type 'FooNonExistentProtocol'}}
113-
// expected-error@-1{{type 'EnumWithInheritance1' does not conform to protocol 'RawRepresentable'}}
114113
// NO-TYREPR: {{^}}enum EnumWithInheritance1 : <<error type>> {{{$}}
115114
// TYREPR: {{^}}enum EnumWithInheritance1 : FooNonExistentProtocol {{{$}}
116115

117116
enum EnumWithInheritance2 : FooNonExistentProtocol, BarNonExistentProtocol {} // expected-error {{use of undeclared type 'FooNonExistentProtocol'}} expected-error {{use of undeclared type 'BarNonExistentProtocol'}}
118-
// expected-error@-1{{type 'EnumWithInheritance2' does not conform to protocol 'RawRepresentable'}}
119117
// NO-TYREPR: {{^}}enum EnumWithInheritance2 : <<error type>>, <<error type>> {{{$}}
120118
// TYREPR: {{^}}enum EnumWithInheritance2 : FooNonExistentProtocol, BarNonExistentProtocol {{{$}}
121119

test/decl/nested/protocol.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ protocol Racoon {
5252
}
5353

5454
enum SillyRawEnum : SillyProtocol.InnerClass {}
55-
// expected-error@-1 {{type 'SillyRawEnum' does not conform to protocol 'RawRepresentable'}}
5655

5756
protocol SillyProtocol {
5857
class InnerClass<T> {} // expected-error {{type 'InnerClass' cannot be nested in protocol 'SillyProtocol'}}

test/decl/overload.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class mixed_redecl3 {} // expected-note {{previously declared here}}
7676
enum mixed_redecl3 {} // expected-error {{invalid redeclaration}}
7777
// expected-note @-1 2{{found this candidate}}
7878
enum mixed_redecl3a : mixed_redecl3 {} // expected-error {{'mixed_redecl3' is ambiguous for type lookup in this context}}
79-
// expected-error @-1{{'mixed_redecl3a' does not conform}}
8079
class mixed_redecl3b : mixed_redecl3 {} // expected-error {{'mixed_redecl3' is ambiguous for type lookup in this context}}
8180

8281
class mixed_redecl4 {} // expected-note {{previously declared here}}

0 commit comments

Comments
 (0)