File tree 2 files changed +24
-4
lines changed
compiler/src/dotty/tools/dotc/typer
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 =>
1227
1227
case pt : MethodOrPoly => 1 + extensionParamsCount(pt.resType)
1228
1228
case _ => 0
1229
1229
val ddef = tpd.DefDef (forwarder.asTerm, prefss => {
1230
+ val forwarderCtx = ctx.withOwner(forwarder)
1230
1231
val (pathRefss, methRefss) = prefss.splitAt(extensionParamsCount(path.tpe.widen))
1231
1232
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
1234
1241
})
1235
- if forwarder.isInlineMethod then
1236
- PrepareInlineable .registerInlineInfo(forwarder, ddef.rhs)
1237
1242
buf += ddef.withSpan(span)
1238
1243
if hasDefaults then
1239
1244
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