Skip to content

Commit 010acc6

Browse files
committed
Improve error message for inline if
Showing the reduced condition is much more useful than showing the original condition.
1 parent 1f433d5 commit 010acc6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
12351235
else Block(cond1 :: Nil, selected)
12361236
case cond1 =>
12371237
if (tree.isInline)
1238-
errorTree(tree, em"""cannot reduce inline if
1239-
| its condition ${tree.cond}
1240-
| is not a constant value""")
1238+
errorTree(tree,
1239+
em"Cannot reduce `inline if` because its condition is not a constant value: $cond1")
12411240
else
12421241
cond1.computeNullableDeeply()
12431242
val if1 = untpd.cpy.If(tree)(cond = untpd.TypedSplice(cond1))

0 commit comments

Comments
 (0)