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
Copy file name to clipboardExpand all lines: test/decl/enum/enumtest.swift
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -497,3 +497,29 @@ let _: EnumWithStaticNone4? = .none // expected-warning {{assuming you mean 'Opt
497
497
498
498
let _:EnumWithStaticFuncNone1?=.none // Okay
499
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 // Okay
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