Skip to content

Change "enum element" to "enum case" in diagnostics #17964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ERROR(could_not_use_type_member_on_instance,none,
"static member %1 cannot be used on instance of type %0",
(Type, DeclName))
ERROR(could_not_use_enum_element_on_instance,none,
"enum element %0 cannot be referenced as an instance member",
"enum case %0 cannot be used as an instance member",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed referenced to used here. That seems both clearer and more consistent with other diagnostics.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disgnostic should be specialized for implicit self so we can offer something more specific than this. Especially in the common “switch-case is missing a leading dot” examples.

Not something to worry about here, but definitely nice to have in a follow-up.

(DeclName))
ERROR(could_not_use_type_member_on_protocol_metatype,none,
"static member %1 cannot be used on protocol metatype %0",
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ StringRef Decl::getDescriptiveKindName(DescriptiveDeclKind K) {
ENTRY(MaterializeForSet, "materializeForSet accessor");
ENTRY(Addressor, "address accessor");
ENTRY(MutableAddressor, "mutableAddress accessor");
ENTRY(EnumElement, "enum element");
ENTRY(EnumElement, "enum case");
ENTRY(Module, "module");
ENTRY(MissingMember, "missing member placeholder");
ENTRY(Requirement, "requirement");
Expand Down
30 changes: 15 additions & 15 deletions test/Compatibility/tuple_arguments_4.swift
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,10 @@ do {
_ = Enum.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
_ = Enum.two(3 > 4 ? 3 : 4) // expected-error {{missing argument for parameter #2 in call}}

_ = Enum.tuple(3, 4) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple((3, 4))

_ = Enum.labeledTuple(x: 3, 4) // expected-error {{enum element 'labeledTuple' expects a single parameter of type '(Int, Int)'}}
_ = Enum.labeledTuple(x: 3, 4) // expected-error {{enum case 'labeledTuple' expects a single parameter of type '(Int, Int)'}}
_ = Enum.labeledTuple(x: (3, 4))
}

Expand All @@ -649,7 +649,7 @@ do {
_ = Enum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = Enum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = Enum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple((a, b))
_ = Enum.tuple(c)
}
Expand All @@ -663,7 +663,7 @@ do {
_ = Enum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = Enum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = Enum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple((a, b))
_ = Enum.tuple(c)
}
Expand Down Expand Up @@ -1136,23 +1136,23 @@ do {
_ = GenericEnum.two(3, 4)
_ = GenericEnum.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum.tuple(3, 4) // expected-error {{enum element 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple((3, 4))
}

do {
_ = GenericEnum<(Int, Int)>.one(3, 4) // expected-error {{enum element 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one(3, 4) // expected-error {{enum case 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one((3, 4))

_ = GenericEnum<(Int, Int)>.labeled(x: 3, 4) // expected-error {{enum element 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled(x: 3, 4) // expected-error {{enum case 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled(x: (3, 4))
_ = GenericEnum<(Int, Int)>.labeled(3, 4) // expected-error {{enum element 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled(3, 4) // expected-error {{enum case 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled((3, 4)) // expected-error {{missing argument label 'x:' in call}}

_ = GenericEnum<Int>.two(3, 4)
_ = GenericEnum<Int>.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum<Int>.tuple(3, 4) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple((3, 4))
}

Expand All @@ -1169,7 +1169,7 @@ do {
_ = GenericEnum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple((a, b))
_ = GenericEnum.tuple(c)
}
Expand All @@ -1179,15 +1179,15 @@ do {
let b = 4
let c = (a, b)

_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum element 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum case 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one((a, b))
_ = GenericEnum<(Int, Int)>.one(c)

_ = GenericEnum<Int>.two(a, b)
_ = GenericEnum<Int>.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum<Int>.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple((a, b))
_ = GenericEnum<Int>.tuple(c)
}
Expand All @@ -1205,7 +1205,7 @@ do {
_ = GenericEnum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple((a, b))
_ = GenericEnum.tuple(c)
}
Expand All @@ -1215,15 +1215,15 @@ do {
var b = 4
var c = (a, b)

_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum element 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum case 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one((a, b))
_ = GenericEnum<(Int, Int)>.one(c)

_ = GenericEnum<Int>.two(a, b)
_ = GenericEnum<Int>.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum<Int>.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple((a, b))
_ = GenericEnum<Int>.tuple(c)
}
Expand Down
10 changes: 5 additions & 5 deletions test/Constraints/members.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ struct GZ<T> {
var i : T
func getI() -> T { return i }

func f1<U>(_ a: T, b: U) -> (T, U) {
func f1<U>(_ a: T, b: U) -> (T, U) {
return (a, b)
}

func f2() {
var f : Float
var t = f1(i, b: f)
Expand Down Expand Up @@ -119,7 +119,7 @@ var wcurriedFull : () = w.curried(0)(1)

// Member of enum type
func enumMetatypeMember(_ opt: Int?) {
opt.none // expected-error{{enum element 'none' cannot be referenced as an instance member}}
opt.none // expected-error{{enum case 'none' cannot be used as an instance member}}
}

////
Expand Down Expand Up @@ -315,7 +315,7 @@ struct S22490787 {

func f22490787() {
var path: S22490787 = S22490787()

for p in path { // expected-error {{type 'S22490787' does not conform to protocol 'Sequence'}}
}
}
Expand Down Expand Up @@ -348,7 +348,7 @@ enum SR_2193_Error: Error {

do {
throw SR_2193_Error.Boom
} catch let e as SR_2193_Error.Boom { // expected-error {{enum element 'Boom' is not a member type of 'SR_2193_Error'}}
} catch let e as SR_2193_Error.Boom { // expected-error {{enum case 'Boom' is not a member type of 'SR_2193_Error'}}
}

// rdar://problem/25341015
Expand Down
30 changes: 15 additions & 15 deletions test/Constraints/tuple_arguments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,10 @@ do {
_ = Enum.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}
_ = Enum.two(3 > 4 ? 3 : 4) // expected-error {{missing argument for parameter #2 in call}}

_ = Enum.tuple(3, 4) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple((3, 4))

_ = Enum.labeledTuple(x: 3, 4) // expected-error {{enum element 'labeledTuple' expects a single parameter of type '(Int, Int)'}}
_ = Enum.labeledTuple(x: 3, 4) // expected-error {{enum case 'labeledTuple' expects a single parameter of type '(Int, Int)'}}
_ = Enum.labeledTuple(x: (3, 4))
}

Expand All @@ -650,7 +650,7 @@ do {
_ = Enum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = Enum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = Enum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple((a, b))
_ = Enum.tuple(c)
}
Expand All @@ -664,7 +664,7 @@ do {
_ = Enum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = Enum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = Enum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{18-18=(}} {{22-22=)}}
_ = Enum.tuple((a, b))
_ = Enum.tuple(c)
}
Expand Down Expand Up @@ -1137,23 +1137,23 @@ do {
_ = GenericEnum.two(3, 4)
_ = GenericEnum.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum.tuple(3, 4) // expected-error {{enum element 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple((3, 4))
}

do {
_ = GenericEnum<(Int, Int)>.one(3, 4) // expected-error {{enum element 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one(3, 4) // expected-error {{enum case 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one((3, 4))

_ = GenericEnum<(Int, Int)>.labeled(x: 3, 4) // expected-error {{enum element 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled(x: 3, 4) // expected-error {{enum case 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled(x: (3, 4))
_ = GenericEnum<(Int, Int)>.labeled(3, 4) // expected-error {{enum element 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled(3, 4) // expected-error {{enum case 'labeled' expects a single parameter of type '(Int, Int)'}}
_ = GenericEnum<(Int, Int)>.labeled((3, 4)) // expected-error {{missing argument label 'x:' in call}}

_ = GenericEnum<Int>.two(3, 4)
_ = GenericEnum<Int>.two((3, 4)) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum<Int>.tuple(3, 4) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple(3, 4) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple((3, 4))
}

Expand All @@ -1170,7 +1170,7 @@ do {
_ = GenericEnum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple((a, b))
_ = GenericEnum.tuple(c)
}
Expand All @@ -1180,15 +1180,15 @@ do {
let b = 4
let c = (a, b)

_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum element 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum case 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one((a, b))
_ = GenericEnum<(Int, Int)>.one(c)

_ = GenericEnum<Int>.two(a, b)
_ = GenericEnum<Int>.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum<Int>.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple((a, b))
_ = GenericEnum<Int>.tuple(c)
}
Expand All @@ -1206,7 +1206,7 @@ do {
_ = GenericEnum.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(T, T)'}} {{25-25=(}} {{29-29=)}}
_ = GenericEnum.tuple((a, b))
_ = GenericEnum.tuple(c)
}
Expand All @@ -1216,15 +1216,15 @@ do {
var b = 4
var c = (a, b)

_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum element 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one(a, b) // expected-error {{enum case 'one' expects a single parameter of type '(Int, Int)'}} {{35-35=(}} {{39-39=)}}
_ = GenericEnum<(Int, Int)>.one((a, b))
_ = GenericEnum<(Int, Int)>.one(c)

_ = GenericEnum<Int>.two(a, b)
_ = GenericEnum<Int>.two((a, b)) // expected-error {{missing argument for parameter #2 in call}}
_ = GenericEnum<Int>.two(c) // expected-error {{missing argument for parameter #2 in call}}

_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum element 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple(a, b) // expected-error {{enum case 'tuple' expects a single parameter of type '(Int, Int)'}} {{30-30=(}} {{34-34=)}}
_ = GenericEnum<Int>.tuple((a, b))
_ = GenericEnum<Int>.tuple(c)
}
Expand Down
2 changes: 1 addition & 1 deletion test/Generics/generic_types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@ struct UnsolvableInheritance2<T : U.A, U : T.A> {}
// expected-error@-1 {{inheritance from non-protocol, non-class type 'U.A'}}
// expected-error@-2 {{inheritance from non-protocol, non-class type 'T.A'}}

enum X7<T> where X7.X : G { case X } // expected-error{{enum element 'X' is not a member type of 'X7<T>'}}
enum X7<T> where X7.X : G { case X } // expected-error{{enum case 'X' is not a member type of 'X7<T>'}}
// expected-error@-1{{use of undeclared type 'G'}}
16 changes: 8 additions & 8 deletions test/Parse/enum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ enum SE0036 {
}

func staticReferenceInInstanceMethod() {
_ = A // expected-error {{enum element 'A' cannot be referenced as an instance member}} {{9-9=SE0036.}}
_ = self.A // expected-error {{enum element 'A' cannot be referenced as an instance member}} {{none}}
_ = A // expected-error {{enum case 'A' cannot be used as an instance member}} {{9-9=SE0036.}}
_ = self.A // expected-error {{enum case 'A' cannot be used as an instance member}} {{none}}
_ = SE0036.A
}

Expand All @@ -483,9 +483,9 @@ enum SE0036 {

func staticReferenceInSwitchInInstanceMethod() {
switch self {
case A: break // expected-error {{enum element 'A' cannot be referenced as an instance member}} {{10-10=.}}
case B(_): break // expected-error {{enum element 'B' cannot be referenced as an instance member}} {{10-10=.}}
case C(let x): _ = x; break // expected-error {{enum element 'C' cannot be referenced as an instance member}} {{10-10=.}}
case A: break // expected-error {{enum case 'A' cannot be used as an instance member}} {{10-10=.}}
case B(_): break // expected-error {{enum case 'B' cannot be used as an instance member}} {{10-10=.}}
case C(let x): _ = x; break // expected-error {{enum case 'C' cannot be used as an instance member}} {{10-10=.}}
}
}

Expand Down Expand Up @@ -515,10 +515,10 @@ enum SE0036 {

init() {
self = .A
self = A // expected-error {{enum element 'A' cannot be referenced as an instance member}} {{12-12=.}}
self = A // expected-error {{enum case 'A' cannot be used as an instance member}} {{12-12=.}}
self = SE0036.A
self = .B(SE0036_Auxiliary())
self = B(SE0036_Auxiliary()) // expected-error {{enum element 'B' cannot be referenced as an instance member}} {{12-12=.}}
self = B(SE0036_Auxiliary()) // expected-error {{enum case 'B' cannot be used as an instance member}} {{12-12=.}}
self = SE0036.B(SE0036_Auxiliary())
}
}
Expand All @@ -528,7 +528,7 @@ enum SE0036_Generic<T> {

func foo() {
switch self {
case A(_): break // expected-error {{enum element 'A' cannot be referenced as an instance member}} {{10-10=.}}
case A(_): break // expected-error {{enum case 'A' cannot be used as an instance member}} {{10-10=.}}
}

switch self {
Expand Down
2 changes: 1 addition & 1 deletion test/attr/attr_objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,7 @@ enum BadEnum1: Int { case X }

@objc
enum BadEnum2: Int {
@objc(X:) // expected-error{{'@objc' enum element must have a simple name}}{{10-11=}}
@objc(X:) // expected-error{{'@objc' enum case must have a simple name}}{{10-11=}}
case X
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct P<I, O> {
public func test() -> P<I, [O]> {
return P<I, [O]> { input in
var output: [O] = []
_ = R<([O], I)>.value(output, input) // expected-error {{enum element 'value' expects a single parameter of type '([O], I)'}}
_ = R<([O], I)>.value(output, input) // expected-error {{enum case 'value' expects a single parameter of type '([O], I)'}}
return R<([O], I)>.value((output, input))
}
}
Expand Down