File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
compiler/src/dotty/tools/dotc/cc Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -910,7 +910,7 @@ class CheckCaptures extends Recheck, SymTransformer:
910
910
* This solves the soundness issue caused by the ill-formness of ?1.
911
911
*/
912
912
private def healTypeParam (tree : Tree )(using Context ): Unit =
913
- val tm = new TypeMap with IdempotentCaptRefMap :
913
+ val checker = new TypeTraverser :
914
914
private def isAllowed (ref : CaptureRef ): Boolean = ref match
915
915
case ref : TermParamRef => allowed.contains(ref)
916
916
case _ => true
@@ -947,25 +947,26 @@ class CheckCaptures extends Recheck, SymTransformer:
947
947
948
948
private var allowed : SimpleIdentitySet [TermParamRef ] = SimpleIdentitySet .empty
949
949
950
- def apply (tp : Type ) =
950
+ def traverse (tp : Type ) =
951
951
tp match
952
952
case CapturingType (parent, refs) =>
953
953
healCaptureSet(refs)
954
- mapOver(tp)
954
+ // mapOver(tp)
955
+ traverseChildren(parent)
955
956
case tp @ RefinedType (parent, rname, rinfo : MethodType ) =>
956
- this (rinfo)
957
+ traverseChildren (rinfo)
957
958
case tp : TermLambda =>
958
959
val localParams : List [TermParamRef ] = tp.paramRefs
959
960
val saved = allowed
960
961
try
961
962
localParams foreach { x => allowed = allowed + x }
962
- mapOver (tp)
963
+ traverseChildren (tp)
963
964
finally allowed = saved
964
965
case _ =>
965
- mapOver (tp)
966
+ traverseChildren (tp)
966
967
967
968
if tree.isInstanceOf [InferredTypeTree ] then
968
- tm (tree.knownType)
969
+ checker.traverse (tree.knownType)
969
970
end healTypeParam
970
971
971
972
/** Perform the following kinds of checks
You can’t perform that action at this time.
0 commit comments