Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract class Dependencies(root: ast.tpd.Tree, @constructorOnly rootContext: Co
def tracked: Iterable[Symbol] = free.keys

/** The outermost class that captures all free variables of a function
* that are captured by enclosinh classes (this means that the function could
* that are captured by enclosing classes (this means that the function could
* be placed in that class without having to add more environment parameters)
*/
def logicalOwner: collection.Map[Symbol, Symbol] = logicOwner
Expand Down
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/transform/LambdaLift.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ object LambdaLift:

private def proxy(sym: Symbol)(using Context): Symbol = {
def liftedEnclosure(sym: Symbol) =
deps.logicalOwner.getOrElse(sym, sym.enclosure)
if sym.is(Method)
then deps.logicalOwner.getOrElse(sym, sym.enclosure)
else sym.enclosure
def searchIn(enclosure: Symbol): Symbol = {
if (!enclosure.exists) {
def enclosures(encl: Symbol): List[Symbol] =
Expand Down
13 changes: 13 additions & 0 deletions tests/pos/i21931.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def f() =
val NotFound: Char = 'a'
class crashing() {
class issue() {
NotFound
}
class Module() {
val obligatory =
class anonIssue() {
issue()
}
}
}
Loading