Skip to content

Commit

Permalink
Fix bug related to inlined unary extension methods
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odersky committed Feb 9, 2019
1 parent 625e4a9 commit d7eafe1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,12 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
val app =
typed(untpd.Apply(core, untpd.TypedSplice(receiver) :: Nil), pt1, ctx.typerState.ownedVars)(
ctx.addMode(Mode.SynthesizeExtMethodReceiver))
if (!app.symbol.is(Extension))
val appSym =
app match {
case Inlined(call, _, _) => call.symbol
case _ => app.symbol
}
if (!appSym.is(Extension))
ctx.error(em"not an extension method: $methodRef", receiver.sourcePos)
app
}
Expand Down

0 comments on commit d7eafe1

Please sign in to comment.