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:
910910 * This solves the soundness issue caused by the ill-formness of ?1.
911911 */
912912 private def healTypeParam (tree : Tree )(using Context ): Unit =
913- val tm = new TypeMap with IdempotentCaptRefMap :
913+ val checker = new TypeTraverser :
914914 private def isAllowed (ref : CaptureRef ): Boolean = ref match
915915 case ref : TermParamRef => allowed.contains(ref)
916916 case _ => true
@@ -947,25 +947,26 @@ class CheckCaptures extends Recheck, SymTransformer:
947947
948948 private var allowed : SimpleIdentitySet [TermParamRef ] = SimpleIdentitySet .empty
949949
950- def apply (tp : Type ) =
950+ def traverse (tp : Type ) =
951951 tp match
952952 case CapturingType (parent, refs) =>
953953 healCaptureSet(refs)
954- mapOver(tp)
954+ // mapOver(tp)
955+ traverseChildren(parent)
955956 case tp @ RefinedType (parent, rname, rinfo : MethodType ) =>
956- this (rinfo)
957+ traverseChildren (rinfo)
957958 case tp : TermLambda =>
958959 val localParams : List [TermParamRef ] = tp.paramRefs
959960 val saved = allowed
960961 try
961962 localParams foreach { x => allowed = allowed + x }
962- mapOver (tp)
963+ traverseChildren (tp)
963964 finally allowed = saved
964965 case _ =>
965- mapOver (tp)
966+ traverseChildren (tp)
966967
967968 if tree.isInstanceOf [InferredTypeTree ] then
968- tm (tree.knownType)
969+ checker.traverse (tree.knownType)
969970 end healTypeParam
970971
971972 /** Perform the following kinds of checks
You can’t perform that action at this time.
0 commit comments