Skip to content

Commit 2f557b5

Browse files
authored
Merge pull request #6269 from dotty-staging/check-inline-parameters-from-inlined-expression
Fix checkInlineConformant check for inlined trees
2 parents 95fd03e + 576f7b1 commit 2f557b5

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ object Splicer {
356356
interpretTree(expr)(newEnv)
357357
case NamedArg(_, arg) => interpretTree(arg)
358358

359-
case Inlined(EmptyTree, Nil, expansion) => interpretTree(expansion)
359+
case Inlined(_, Nil, expansion) => interpretTree(expansion)
360360

361361
case Typed(expr, _) =>
362362
interpretTree(expr)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,8 @@ trait Checking {
710710
tree match {
711711
case Typed(expr, _) =>
712712
checkInlineConformant(expr, isFinal, what)
713+
case Inlined(_, Nil, expr) =>
714+
checkInlineConformant(expr, isFinal, what)
713715
case SeqLiteral(elems, _) =>
714716
elems.foreach(elem => checkInlineConformant(elem, isFinal, what))
715717
case Apply(fn, List(arg)) if defn.WrapArrayMethods().contains(fn.symbol) =>

tests/pos/inlined-inline-param.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Foo {
2+
inline def foo(inline x: Int): Int = x
3+
def bar: Int = foo(foo(4))
4+
}

tests/run-with-compiler/reflect-inline/assert_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import scala.quoted._
22
import scala.tasty._
33

44
object api {
5-
inline def (inline x: String) stripMargin <: String =
5+
inline def (inline x: String) stripMargin: String =
66
${ stripImpl(x) }
77

88
private def stripImpl(x: String)(implicit refl: Reflection): Expr[String] =

0 commit comments

Comments
 (0)