Skip to content

Commit 6e92de8

Browse files
authored
Merge pull request #14008 from dcci/rdar36559617
2 parents 3058912 + 4cc84f5 commit 6e92de8

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

lib/SIL/SILVerifier.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,8 +1629,10 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
16291629
"EnumInst operand must be an object");
16301630
SILType caseTy = UI->getType().getEnumElementType(UI->getElement(),
16311631
F.getModule());
1632-
require(caseTy == UI->getOperand()->getType(),
1633-
"EnumInst operand type does not match type of case");
1632+
if (UI->getModule().getStage() != SILStage::Lowered) {
1633+
require(caseTy == UI->getOperand()->getType(),
1634+
"EnumInst operand type does not match type of case");
1635+
}
16341636
}
16351637
}
16361638

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Check that we don't crash when we verify after every pass.
2+
// RUN: %empty-directory(%t)
3+
//
4+
// RUN: %target-swift-frontend %s -I %S/../stdlib/Inputs/Mirror/ -o %t/Mirror \
5+
// RUN: -emit-ir -sil-verify-all -o /dev/null
6+
7+
class A : CustomReflectable {
8+
var a: Int = 1
9+
var customMirror: Mirror {
10+
return Mirror(self, children: ["aye": a])
11+
}
12+
}
13+
class X : A {}
14+
class Y : X {}
15+
class B : Y {
16+
var b: UInt = 42
17+
override var customMirror: Mirror {
18+
return Mirror(
19+
self,
20+
children: ["bee": b],
21+
ancestorRepresentation: .customized({ super.customMirror }))
22+
}
23+
}

0 commit comments

Comments
 (0)