File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -171,3 +171,28 @@ struct EnumElementPatternFromContextualType<T> {
171171 }
172172 }
173173}
174+
175+ // SR-14408
176+ enum CompassPoint {
177+ case North( Int )
178+ case South
179+ case East
180+ case West
181+ }
182+
183+ func isNorth( c : CompassPoint ) -> Bool {
184+ // expected-error@+1{{member 'North' expects argument of type 'Int'}}
185+ return c == . North // expected-error {{binary operator '==' cannot be applied to two 'CompassPoint' operands}}
186+ // expected-note@-1 {{binary operator '==' cannot be synthesized for enums with associated values}}
187+ }
188+
189+ func isNorth2( c : CompassPoint ) -> Bool {
190+ // expected-error@+1{{member 'North' expects argument of type 'Int'}}
191+ return . North == c // expected-error {{binary operator '==' cannot be applied to two 'CompassPoint' operands}}
192+ // expected-note@-1 {{binary operator '==' cannot be synthesized for enums with associated values}}
193+ }
194+
195+ func isSouth( c : CompassPoint ) -> Bool {
196+ return c == . South // expected-error {{binary operator '==' cannot be applied to two 'CompassPoint' operands}}
197+ // expected-note@-1 {{binary operator '==' cannot be synthesized for enums with associated values}}
198+ }
You can’t perform that action at this time.
0 commit comments