diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 70861d4be87c..41d3eefaa321 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -1035,7 +1035,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { case _ => false } } - if (guardOK) Some((caseBindings, cdef.body.subst(from, to))) + if (guardOK) Some((caseBindings.map(_.subst(from, to)), cdef.body.subst(from, to))) else None } else None @@ -1135,7 +1135,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { } case _ => rhs0 } - val (usedBindings, rhs2) = dropUnusedDefs(caseBindings, rhs1) val rhs = seq(usedBindings, rhs2) inlining.println(i"""--- reduce: diff --git a/tests/pos/i7878.scala b/tests/pos/i7878.scala new file mode 100644 index 000000000000..d47bb32f1a65 --- /dev/null +++ b/tests/pos/i7878.scala @@ -0,0 +1,15 @@ +object Boom { + import scala.compiletime._ + trait Fail[A <: Int, B <: Int] + + erased inline given fail[X <: Int, Y <: Int]: Fail[X, Y] = { + scala.compiletime.summonFrom { + case t: Fail[X, y] if constValue[y] < constValue[Y] => ??? + } + } + + val a: Int = 1 + given ev1: Fail[a.type, 2] = null + + summon[Fail[a.type, 3]] +} \ No newline at end of file