Skip to content

Commit

Permalink
Fix outerSelect in Inliner
Browse files Browse the repository at this point in the history
Fixes #20300

[Cherry-picked ae82716]
  • Loading branch information
odersky authored and WojciechMazur committed Jul 6, 2024
1 parent ff5bc2f commit 319d2c6
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 319d2c6

Please sign in to comment.