Skip to content

Commit 05ba906

Browse files
committed
Constrain closure parameters and results early
This makes error messages more localized and specific.
1 parent 21348b1 commit 05ba906

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ class CheckCaptures extends Recheck, SymTransformer:
586586
// Constrain closure's parameters and result from the expected type before
587587
// rechecking the body.
588588
val res = recheckClosure(expr, pt, forceDependent = true)
589+
checkConformsExpr(res, pt, expr)
589590
recheckDef(mdef, mdef.symbol)
590591
//println(i"RECHECK CLOSURE ${mdef.symbol.info}")
591592
res

0 commit comments

Comments
 (0)