You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Make sure we don't diagnose 'static let none = 1', but do diagnose 'static let none = TheEnum.anotherCase' ///
481
+
482
+
let _:EnumWithStaticNone1?=.none // Okay
483
+
let _:EnumWithStaticNone2?=.none // expected-warning {{assuming you mean 'Optional<EnumWithStaticNone2>.none'; did you mean 'EnumWithStaticNone2.none' instead?}}
484
+
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{31-31=Optional}}
/// Make sure we diagnose if we have both static and instance 'none' member regardless of source order ///
488
+
489
+
let _:EnumWithStaticNone3?=.none // expected-warning {{assuming you mean 'Optional<EnumWithStaticNone3>.none'; did you mean 'EnumWithStaticNone3.none' instead?}}
490
+
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{31-31=Optional}}
let _:EnumWithStaticNone4?=.none // expected-warning {{assuming you mean 'Optional<EnumWithStaticNone4>.none'; did you mean 'EnumWithStaticNone4.none' instead?}}
493
+
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{31-31=Optional}}
/// Make sure we don't diagnose 'static func none -> T' ///
497
+
498
+
let _:EnumWithStaticFuncNone1?=.none // Okay
499
+
let _:EnumWithStaticFuncNone2?=.none // Okay
500
+
501
+
/// Make sure we diagnose generic ones as well including conditional ones ///
502
+
503
+
enumGenericEnumWithStaticNone<T>{
504
+
case a
505
+
staticvarnone:GenericEnumWithStaticNone<Int>{.a }
506
+
}
507
+
508
+
let _:GenericEnumWithStaticNone<Int>?=.none // expected-warning {{assuming you mean 'Optional<GenericEnumWithStaticNone<Int>>.none'; did you mean 'GenericEnumWithStaticNone<Int>.none' instead?}}
509
+
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{42-42=Optional}}
let _:GenericEnumWithStaticNone<String>?=.none // Okay
512
+
let _:GenericEnumWithStaticNone?=.none // FIXME(SR-11535): This should be diagnosed
513
+
514
+
enumGenericEnumWithoutNone<T>{
515
+
case a
516
+
}
517
+
518
+
extensionGenericEnumWithoutNonewhere T ==Int{
519
+
staticvarnone:GenericEnumWithoutNone<Int>{.a }
520
+
}
521
+
522
+
let _:GenericEnumWithoutNone<Int>?=.none // expected-warning {{assuming you mean 'Optional<GenericEnumWithoutNone<Int>>.none'; did you mean 'GenericEnumWithoutNone<Int>.none' instead?}}
523
+
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{39-39=Optional}}
0 commit comments