Skip to content

Commit

Permalink
Add skipLocalOwners
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Oct 11, 2021
1 parent 0b072d6 commit 09cb925
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,11 @@ object SymDenotations {
enclClass(symbol, false)
}

/** Skips symbol that are not owned by a class */
def skipLocalOwners(using Context): Symbol =
if symbol.owner.isClass then symbol
else symbol.owner.skipLocalOwners

/** A class that in source code would be lexically enclosing */
final def lexicallyEnclosingClass(using Context): Symbol =
if (!exists || isClass) symbol else owner.lexicallyEnclosingClass
Expand Down
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ trait QuotesAndSplices {
}

private def makeInlineable(tree: Tree)(using Context): Tree =
def quoteOwner(sym: Symbol): Symbol =
if sym.owner.isClass then sym else quoteOwner(sym.owner)
inContext(ctx.withOwner(quoteOwner(ctx.owner))) {
inContext(ctx.withOwner(ctx.owner.skipLocalOwners)) {
PrepareInlineable.makeInlineable(tree)
}

Expand Down

0 comments on commit 09cb925

Please sign in to comment.