File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
compiler/src/dotty/tools/dotc/cc Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -991,23 +991,20 @@ class CheckCaptures extends Recheck, SymTransformer:
991
991
}
992
992
993
993
// Capture set of the term after adaptation
994
- val cs1 = if covariant then cs ++ leaked else cs
995
-
996
- def checkLeaked : Boolean =
997
- covariant || leaked.subCaptures(cs1, frozen = false ).isOK || {
998
- report.error(
999
- em """ $expected cannot be box-converted to $actual
1000
- |since the additional capture set $leaked resulted from box conversion is not allowed in $actual""" , pos)
1001
- false
1002
- }
994
+ val cs1 =
995
+ if covariant then cs ++ leaked
996
+ else
997
+ if ! leaked.subCaptures(cs, frozen = false ).isOK then
998
+ report.error(
999
+ em """ $expected cannot be box-converted to $actual
1000
+ |since the additional capture set $leaked resulted from box conversion is not allowed in $actual""" , pos)
1001
+ cs
1003
1002
1004
1003
// Compute the adapted type
1005
1004
def adaptedType (resultBoxed : Boolean ) =
1006
1005
if (styp1 eq styp) && leaked.isAlwaysEmpty && boxed == resultBoxed then actual
1007
1006
else styp1.capturing(if alwaysConst then CaptureSet (cs1.elems) else cs1).forceBoxStatus(resultBoxed)
1008
1007
1009
- checkLeaked
1010
-
1011
1008
if needsAdaptation then
1012
1009
val criticalSet = // the set which is not allowed to have `cap`
1013
1010
if covariant then cs1 // can't box with `cap`
You can’t perform that action at this time.
0 commit comments