Skip to content

Commit 35a2c55

Browse files
committed
Fix checkInlineConformant check for inlined trees
We where considering an `Inlined` tree as not conformant even if its contents are conformat. Now we check if the exapnsion is conformant.
1 parent 95fd03e commit 35a2c55

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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+
}

0 commit comments

Comments
 (0)