Skip to content

Commit bf305bf

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

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, em"""Cannot reduce `inline if` with non constant value.
1239+
|Condition is: $cond1""")
12411240
else
12421241
cond1.computeNullableDeeply()
12431242
val if1 = untpd.cpy.If(tree)(cond = untpd.TypedSplice(cond1))

0 commit comments

Comments
 (0)