Skip to content

Commit

Permalink
Backport "Fix outerSelect in Inliner" to LTS (#21094)
Browse files Browse the repository at this point in the history
Backports #20313 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
WojciechMazur authored Jul 6, 2024
2 parents 02d48c1 + 319d2c6 commit 591477b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/inlines/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/i20300.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
trait T:

def v() = ()

trait F:
def f(): Unit =
inline def op(): Unit = v()
op()

0 comments on commit 591477b

Please sign in to comment.