File tree 2 files changed +14
-2
lines changed
compiler/src/dotty/tools/dotc/inlines
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -877,8 +877,12 @@ class Inliner(val call: tpd.Tree)(using Context):
877
877
}
878
878
case _ => rhs0
879
879
}
880
- val (usedBindings, rhs2) = dropUnusedDefs(caseBindings, rhs1)
881
- val rhs = seq(usedBindings, rhs2)
880
+ val rhs2 = rhs1 match {
881
+ case Typed (expr, tpt) if rhs1.span.isSynthetic => constToLiteral(expr)
882
+ case _ => constToLiteral(rhs1)
883
+ }
884
+ val (usedBindings, rhs3) = dropUnusedDefs(caseBindings, rhs2)
885
+ val rhs = seq(usedBindings, rhs3)
882
886
inlining.println(i """ --- reduce:
883
887
| $tree
884
888
|--- to:
Original file line number Diff line number Diff line change
1
+ transparent inline def f : String =
2
+ inline 10 match
3
+ case _ =>
4
+ inline Some [" foo" ](" foo" ) match
5
+ case Some (x) => x
6
+
7
+ def test =
8
+ inline val failMsg = f
You can’t perform that action at this time.
0 commit comments