@@ -934,32 +934,17 @@ class CheckCaptures extends Recheck, SymTransformer:
934
934
935
935
private def healCaptureSet (cs : CaptureSet ): Unit =
936
936
val toInclude = widenParamRefs(cs.elems.toList.filter(! isAllowed(_)).asInstanceOf )
937
- toInclude foreach { cs1 =>
938
- // We omit the check of the result of capture set inclusion here,
939
- // since there are only two possible kinds of errors.
940
- // Both kinds will be detected in other places and tend to
941
- // give better error messages.
942
- //
943
- // The two kinds of errors are:
944
- // - Pushing `*` to a boxed capture set.
945
- // This triggers error reporting registered as the `rootAddedHandler`
946
- // in `CaptureSet`.
947
- // - Failing to include a capture reference in a capture set.
948
- // This is mostly due to the restriction placed by explicit type annotations,
949
- // and should already be reported as a type mismatch during `checkConforms`.
950
- cs1.subCaptures(cs, frozen = false )
951
- }
937
+ toInclude.foreach(checkSubset(_, cs, tree.srcPos))
952
938
953
939
private var allowed : SimpleIdentitySet [TermParamRef ] = SimpleIdentitySet .empty
954
940
955
941
def traverse (tp : Type ) =
956
942
tp match
957
943
case CapturingType (parent, refs) =>
958
944
healCaptureSet(refs)
959
- // mapOver(tp)
960
- traverseChildren(parent)
945
+ traverse(parent)
961
946
case tp @ RefinedType (parent, rname, rinfo : MethodType ) if defn.isFunctionType(tp) =>
962
- traverseChildren (rinfo)
947
+ traverse (rinfo)
963
948
case tp : TermLambda =>
964
949
val saved = allowed
965
950
try
0 commit comments