Error message with capture sets variables can be confusing #21998
Labels
area:experimental:cc
Capture checking related
area:reporting
Error reporting including formatting, implicit suggestions, etc
better-errors
Issues concerned with improving confusing/unhelpful diagnostic messages
itype:enhancement
Compiler version
3.6.2
Minimized example
Output
Expectation
I would have liked to see instead:
The problem is that there a capture set variable generated for the closure result which has
{cap2}
as its upper capture set. That information is important, but gets suppressed in the error diagnostic. We could take all contravariant capture sets in the expected type and interpolate each of them with the maximal set that satisfies their constraints. Then, if the subtype test still fails we could use the interpolated sets instead of the original variables. That would help.The text was updated successfully, but these errors were encountered: