Skip to content

Commit d684f60

Browse files
committed
Polish and document separation checker (2)
Use a coarser prediction of hidden sets. Any Fresh.Cap instance in a capture set means that we should do the hidden check. Previously this was the case only if the Fresh.Cap instance hid something non maximal, element, but only directly, not via another Cap. Another version searched for non-maximal references deeply, but this one caused infinite looping in the CI. But in any case it's fine to over-approximate and assume that any Fresh.Cap hides something.
1 parent 0a37cc1 commit d684f60

File tree

3 files changed

+208
-35
lines changed

3 files changed

+208
-35
lines changed

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ class CheckCaptures extends Recheck, SymTransformer:
18391839
end checker
18401840

18411841
checker.traverse(unit)(using ctx.withOwner(defn.RootClass))
1842-
if ccConfig.useSepChecks then SepChecker(this).traverse(unit)
1842+
if ccConfig.useSepChecks then SepCheck(this).traverse(unit)
18431843
if !ctx.reporter.errorsReported then
18441844
// We dont report errors here if previous errors were reported, because other
18451845
// errors often result in bad applied types, but flagging these bad types gives

compiler/src/dotty/tools/dotc/cc/Fresh.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ object Fresh:
6767
case _ => None
6868
end Cap
6969

70+
/** Map each occurrence of cap to a different Sep.Cap instance */
7071
class FromCap(owner: Symbol)(using Context) extends BiTypeMap, FollowAliasesMap:
7172
thisMap =>
7273

0 commit comments

Comments
 (0)