Skip to content

Commit 627b6e5

Browse files
committed
Loosen the "dxoes not match previously inferred" criterion
The expected type here is still the one using cap, not fresh. So it's OK if the actual type uses fresh where the expected uses cap.
1 parent 885f70a commit 627b6e5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -1076,9 +1076,12 @@ class CheckCaptures extends Recheck, SymTransformer:
10761076
tree.tpt match
10771077
case tpt: InferredTypeTree if !canUseInferred =>
10781078
val expected = tpt.tpe.dropAllRetains
1079-
todoAtPostCheck += (() => checkConformsExpr(tp, expected, tree.rhs, addenda(expected)))
1080-
// The check that inferred <: expected is done after recheck so that it
1081-
// does not interfere with normal rechecking by constraining capture set variables.
1079+
todoAtPostCheck += { () =>
1080+
withCapAsRoot:
1081+
checkConformsExpr(tp, expected, tree.rhs, addenda(expected))
1082+
// The check that inferred <: expected is done after recheck so that it
1083+
// does not interfere with normal rechecking by constraining capture set variables.
1084+
}
10821085
case _ =>
10831086
tp
10841087
end checkInferredResult

0 commit comments

Comments
 (0)