File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -1227,13 +1227,18 @@ class Namer { typer: Typer =>
12271227 case pt : MethodOrPoly => 1 + extensionParamsCount(pt.resType)
12281228 case _ => 0
12291229 val ddef = tpd.DefDef (forwarder.asTerm, prefss => {
1230+ val forwarderCtx = ctx.withOwner(forwarder)
12301231 val (pathRefss, methRefss) = prefss.splitAt(extensionParamsCount(path.tpe.widen))
12311232 val ref = path.appliedToArgss(pathRefss).select(sym.asTerm)
1232- ref.appliedToArgss(adaptForwarderParams(Nil , sym.info, methRefss))
1233- .etaExpandCFT(using ctx.withOwner(forwarder))
1233+ val rhs = ref.appliedToArgss(adaptForwarderParams(Nil , sym.info, methRefss))
1234+ .etaExpandCFT(using forwarderCtx)
1235+ if forwarder.isInlineMethod then
1236+ val inlinableRhs = PrepareInlineable .makeInlineable(rhs)(using forwarderCtx)
1237+ PrepareInlineable .registerInlineInfo(forwarder, inlinableRhs)(using forwarderCtx)
1238+ inlinableRhs
1239+ else
1240+ rhs
12341241 })
1235- if forwarder.isInlineMethod then
1236- PrepareInlineable .registerInlineInfo(forwarder, ddef.rhs)
12371242 buf += ddef.withSpan(span)
12381243 if hasDefaults then
12391244 foreachDefaultGetterOf(sym.asTerm,
Original file line number Diff line number Diff line change 1+ class Context {
2+ def normalMethod (): String = " normal"
3+ inline def inlineMethod (): String = " inline"
4+ }
5+
6+ class Script (ctx : Context ) {
7+ export ctx .*
8+ normalMethod()
9+ inlineMethod()
10+ }
11+
12+ class MyScript (context : Context ) extends Script (context) {
13+ normalMethod()
14+ inlineMethod()
15+ }
You can’t perform that action at this time.
0 commit comments