Skip to content

Commit b3d7962

Browse files
committed
[Test] Add some more tests around edge cases
1 parent 2de4755 commit b3d7962

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/decl/enum/enumtest.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,3 +523,32 @@ let _: GenericEnumWithoutNone<Int>? = .none // expected-warning {{assuming you m
523523
// expected-note@-1 {{explicitly specify 'Optional' to silence this warning}}{{39-39=Optional}}
524524
// expected-note@-2 {{use 'GenericEnumWithoutNone<Int>.none' instead}}{{39-39=GenericEnumWithoutNone<Int>}}
525525
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

0 commit comments

Comments
 (0)