Skip to content

Commit e1949bb

Browse files
Add missing .ensureApplied in constantFold
1 parent d7e9107 commit e1949bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/transform/linker/Simplify.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ class Simplify extends MiniPhaseTransform with IdentityDenotTransformer {
343343
case If(cond1, If(cond2, thenp2, elsep2), elsep1) if isSimilar(elsep1, elsep2) =>
344344
If(cond1.select(defn.Boolean_&&).appliedTo(cond2), thenp2, elsep1)
345345
case If(cond1, If(cond2, thenp2, elsep2), elsep1) if isSimilar(elsep1, thenp2) =>
346-
If(cond1.select(defn.Boolean_!).select(defn.Boolean_||).appliedTo(cond2), elsep1, elsep2)
346+
If(cond1.select(defn.Boolean_!).ensureApplied.select(defn.Boolean_||).appliedTo(cond2), elsep1, elsep2)
347347
case If(cond1, thenp1, If(cond2, thenp2, elsep2)) if isSimilar(thenp1, thenp2) =>
348348
If(cond1.select(defn.Boolean_||).appliedTo(cond2), thenp1, elsep2)
349349
case If(cond1, thenp1, If(cond2, thenp2, elsep2)) if isSimilar(thenp1, elsep2) =>
350-
If(cond1.select(defn.Boolean_||).appliedTo(cond2.select(defn.Boolean_!)), thenp1, thenp2)
350+
If(cond1.select(defn.Boolean_||).appliedTo(cond2.select(defn.Boolean_!).ensureApplied), thenp1, thenp2)
351351
case If(t: Literal, thenp, elsep) =>
352352
if (t.const.booleanValue) thenp
353353
else elsep
@@ -368,7 +368,7 @@ class Simplify extends MiniPhaseTransform with IdentityDenotTransformer {
368368
// //if (thenp.const.booleanValue)
369369
// cond.select(defn.Boolean_||).appliedTo(elsep)
370370
// //else // thenp is false, this tree is bigger then the original
371-
// // cond.select(defn.Boolean_!).select(defn.Boolean_&&).appliedTo(elsep)
371+
// // cond.select(defn.Boolean_!).ensureApplied.select(defn.Boolean_&&).appliedTo(elsep)
372372
// case ift @ If(cond, thenp, elsep :Literal) if ift.tpe.derivesFrom(defn.BooleanClass) && !elsep.const.booleanValue =>
373373
// cond.select(defn.Boolean_&&).appliedTo(elsep)
374374
// // the other case ins't handled intentionally. See previous case for explanation

0 commit comments

Comments
 (0)