Use full type when reporting a mismatch error #5833
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The leaf mismatch is the innermost piece of the type that failed to match, but that can occur after the type has been pulled apart multiple times. The full type is the entry point to the subtyping check, and is more likely to correspond to an actual code value.
This fixes #5440. See the changed transcript output for a somewhat different example (where there the kinds made sense to talk about "a value" but there was actually no such value in the code). It might not be 100% guaranteed to never say something that sounds like a kind error, but it's less likely.
One thing I'm not sure about is if you have a really big subtyping call, it might be hard to spot the actual difference in the full types. So maybe I should still include the leaf mismatch with different verbage?