diff --git a/compiler/src/dotty/tools/dotc/inlines/Inliner.scala b/compiler/src/dotty/tools/dotc/inlines/Inliner.scala index d2817a879a04..0e5f51daafdb 100644 --- a/compiler/src/dotty/tools/dotc/inlines/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/inlines/Inliner.scala @@ -315,7 +315,7 @@ class Inliner(val call: tpd.Tree)(using Context): case Super(qual, _) => qual case pre => pre val preLevel = classNestingLevel(inlinedMethod.owner) - if preLevel > level then outerSelect(pre, inlinedMethod.owner, preLevel - level, selfSym.info) + if preLevel > level then outerSelect(pre, inlinedMethod.owner.enclosingClass, preLevel - level, selfSym.info) else pre val binding = accountForOpaques( diff --git a/tests/pos/i20300.scala b/tests/pos/i20300.scala new file mode 100644 index 000000000000..721b79940ba1 --- /dev/null +++ b/tests/pos/i20300.scala @@ -0,0 +1,8 @@ +trait T: + + def v() = () + + trait F: + def f(): Unit = + inline def op(): Unit = v() + op() \ No newline at end of file