mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums (#10326)
* IRGen: EmptyBoxType's representation cannot be nil because of a conflict with extra inhabitant assumption in indirect enums We map nil to the .None case of Optional. Instead use a singleton object. SR-5148 rdar://32618580
This commit is contained in:
committed by
GitHub
parent
6f3b8ca60f
commit
48e889b51b
@@ -553,5 +553,50 @@ presentEitherOr(EitherOr<(), String>.Right("foo")) // CHECK-NEXT: Right(foo)
|
||||
// CHECK-NEXT: Right(foo)
|
||||
presentEitherOrsOf(t: (), u: "foo")
|
||||
|
||||
// SR-5148
|
||||
enum Payload {
|
||||
case email
|
||||
}
|
||||
enum Test {
|
||||
case a
|
||||
indirect case b(Payload)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
func printA() {
|
||||
print("an a")
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
func printB() {
|
||||
print("an b")
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
func testCase(_ testEmail: Test) {
|
||||
switch testEmail {
|
||||
case .a:
|
||||
printA()
|
||||
case .b:
|
||||
printB()
|
||||
}
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
func createTestB() -> Test {
|
||||
return Test.b(.email)
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
func createTestA() -> Test {
|
||||
return Test.a
|
||||
}
|
||||
|
||||
// CHECK-NEXT: an b
|
||||
testCase(createTestB())
|
||||
// CHECK-NEXT: b(a.Payload.email)
|
||||
print(createTestB())
|
||||
// CHECK-NEXT: a
|
||||
print(createTestA())
|
||||
// CHECK-NEXT: done
|
||||
print("done")
|
||||
|
||||
Reference in New Issue
Block a user