Skip to content

Commit 408cec1

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 a64c7cd commit 408cec1

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
@@ -1737,7 +1737,12 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
17371737
val app =
17381738
typed(untpd.Apply(core, untpd.TypedSplice(receiver) :: Nil), pt1, ctx.typerState.ownedVars)(
17391739
ctx.addMode(Mode.SynthesizeExtMethodReceiver))
1740-
if (!app.symbol.is(Extension))
1740+
val appSym =
1741+
app match {
1742+
case Inlined(call, _, _) => call.symbol
1743+
case _ => app.symbol
1744+
}
1745+
if (!appSym.is(Extension))
17411746
ctx.error(em"not an extension method: $methodRef", receiver.sourcePos)
17421747
app
17431748
}

0 commit comments

Comments
 (0)