Skip to content

Commit 8e91299

Browse files
committed
Only force inline conditions of inline if
1 parent 891a96a commit 8e91299

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
12711271
}
12721272

12731273
override def typedIf(tree: untpd.If, pt: Type)(using Context): Tree =
1274-
typed(tree.cond, defn.BooleanType)(using ctx.addMode(Mode.ForceInline)) match {
1274+
val condCtx = if tree.isInline then ctx.addMode(Mode.ForceInline) else ctx
1275+
typed(tree.cond, defn.BooleanType)(using condCtx) match {
12751276
case cond1 @ ConstantValue(b: Boolean) =>
12761277
val selected0 = if (b) tree.thenp else tree.elsep
12771278
val selected = if (selected0.isEmpty) tpd.Literal(Constant(())) else typed(selected0, pt)

0 commit comments

Comments
 (0)