Skip to content

Commit 4d8bf77

Browse files
committed
Use SyntheticUnit attachment to detect if has else branch
1 parent c608177 commit 4d8bf77

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import dotty.tools.dotc.core.Contexts.*
2424
import dotty.tools.dotc.core.Phases.*
2525
import dotty.tools.dotc.core.Decorators.em
2626
import dotty.tools.dotc.report
27+
import dotty.tools.dotc.ast.Trees.SyntheticUnit
2728

2829
/*
2930
*
@@ -218,10 +219,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
218219
val success = new asm.Label
219220
val failure = new asm.Label
220221

221-
val hasElse = !elsep.isEmpty && (elsep match {
222-
case Literal(value) if value.tag == UnitTag => false
223-
case _ => true
224-
})
222+
val hasElse = !elsep.hasAttachment(SyntheticUnit)
225223

226224
genCond(condp, success, failure, targetIfNoJump = success)
227225
markProgramPoint(success)

0 commit comments

Comments
 (0)