File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -523,3 +523,32 @@ let _: GenericEnumWithoutNone<Int>? = .none // expected-warning {{assuming you m
523
523
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{39-39=Optional}}
524
524
// expected-note@-2 {{use 'GenericEnumWithoutNone<Int>.none' instead}}{{39-39=GenericEnumWithoutNone<Int>}}
525
525
let _: GenericEnumWithoutNone < String > ? = . none // Okay
526
+
527
+ // A couple of edge cases that shouldn't trigger the warning //
528
+
529
+ enum EnumWithStructNone {
530
+ case bar
531
+ struct none { }
532
+ }
533
+
534
+ enum EnumWithTypealiasNone {
535
+ case bar
536
+ typealias none = EnumWithTypealiasNone
537
+ }
538
+
539
+ enum EnumWithBothStructAndComputedNone {
540
+ case bar
541
+ struct none { }
542
+ var none : EnumWithBothStructAndComputedNone { . bar }
543
+ }
544
+
545
+ enum EnumWithBothTypealiasAndComputedNone {
546
+ case bar
547
+ typealias none = EnumWithBothTypealiasAndComputedNone
548
+ var none : EnumWithBothTypealiasAndComputedNone { . bar }
549
+ }
550
+
551
+ let _: EnumWithStructNone ? = . none // Okay
552
+ let _: EnumWithTypealiasNone ? = . none // Okay
553
+ let _: EnumWithBothStructAndComputedNone ? = . none // Okay
554
+ let _: EnumWithBothTypealiasAndComputedNone ? = . none // Okay
You can’t perform that action at this time.
0 commit comments