Skip to content

Commit d7eafe1

Browse files
committed
Fix bug related to inlined unary extension methods
Unary extension methods are inlined before the end of `extMethodApply`. Have to take this into account when checking that the call is to an extension method.
1 parent 625e4a9 commit d7eafe1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,12 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
16911691
val app =
16921692
typed(untpd.Apply(core, untpd.TypedSplice(receiver) :: Nil), pt1, ctx.typerState.ownedVars)(
16931693
ctx.addMode(Mode.SynthesizeExtMethodReceiver))
1694-
if (!app.symbol.is(Extension))
1694+
val appSym =
1695+
app match {
1696+
case Inlined(call, _, _) => call.symbol
1697+
case _ => app.symbol
1698+
}
1699+
if (!appSym.is(Extension))
16951700
ctx.error(em"not an extension method: $methodRef", receiver.sourcePos)
16961701
app
16971702
}

0 commit comments

Comments
 (0)