Skip to content

Commit

Permalink
use named arg for nestedInOwner
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed Oct 12, 2022
1 parent 21e90e2 commit 7deb2b0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class CheckCaptures extends Recheck, SymTransformer:
report.error(i"$header included in allowed capture set ${res.blocking}", pos)

/** The current environment */
private var curEnv: Env = Env(NoSymbol, false, CaptureSet.empty, isBoxed = false, null)
private var curEnv: Env = Env(NoSymbol, nestedInOwner = false, CaptureSet.empty, isBoxed = false, null)

private val myCapturedVars: util.EqHashMap[Symbol, CaptureSet] = EqHashMap()

Expand Down Expand Up @@ -451,7 +451,7 @@ class CheckCaptures extends Recheck, SymTransformer:
if !Synthetics.isExcluded(sym) then
val saved = curEnv
val localSet = capturedVars(sym)
if !localSet.isAlwaysEmpty then curEnv = Env(sym, false, localSet, isBoxed = false, curEnv)
if !localSet.isAlwaysEmpty then curEnv = Env(sym, nestedInOwner = false, localSet, isBoxed = false, curEnv)
try super.recheckDefDef(tree, sym)
finally
interpolateVarsIn(tree.tpt)
Expand All @@ -467,7 +467,7 @@ class CheckCaptures extends Recheck, SymTransformer:
val localSet = capturedVars(cls)
for parent <- impl.parents do // (1)
checkSubset(capturedVars(parent.tpe.classSymbol), localSet, parent.srcPos)
if !localSet.isAlwaysEmpty then curEnv = Env(cls, false, localSet, isBoxed = false, curEnv)
if !localSet.isAlwaysEmpty then curEnv = Env(cls, nestedInOwner = false, localSet, isBoxed = false, curEnv)
try
val thisSet = cls.classInfo.selfType.captureSet.withDescription(i"of the self type of $cls")
checkSubset(localSet, thisSet, tree.srcPos) // (2)
Expand Down Expand Up @@ -514,7 +514,7 @@ class CheckCaptures extends Recheck, SymTransformer:
override def recheck(tree: Tree, pt: Type = WildcardType)(using Context): Type =
if tree.isTerm && pt.isBoxedCapturing then
val saved = curEnv
curEnv = Env(curEnv.owner, false, CaptureSet.Var(), isBoxed = true, curEnv)
curEnv = Env(curEnv.owner, nestedInOwner = false, CaptureSet.Var(), isBoxed = true, curEnv)
try super.recheck(tree, pt)
finally curEnv = saved
else
Expand Down Expand Up @@ -613,7 +613,7 @@ class CheckCaptures extends Recheck, SymTransformer:
covariant: Boolean, boxed: Boolean,
reconstruct: (List[Type], Type) => Type): (Type, CaptureSet) =
val saved = curEnv
curEnv = Env(curEnv.owner, true, CaptureSet.Var(), isBoxed = false, if boxed then null else curEnv)
curEnv = Env(curEnv.owner, nestedInOwner = true, CaptureSet.Var(), isBoxed = false, if boxed then null else curEnv)

try
val (eargs, eres) = expected.dealias match
Expand Down Expand Up @@ -643,7 +643,7 @@ class CheckCaptures extends Recheck, SymTransformer:
covariant: Boolean, boxed: Boolean,
reconstruct: Type => Type): (Type, CaptureSet) =
val saved = curEnv
curEnv = Env(curEnv.owner, true, CaptureSet.Var(), isBoxed = false, if boxed then null else curEnv)
curEnv = Env(curEnv.owner, nestedInOwner = true, CaptureSet.Var(), isBoxed = false, if boxed then null else curEnv)

try
val eres = expected.dealias.stripCapturing match
Expand Down

0 comments on commit 7deb2b0

Please sign in to comment.