Print reasons for subtyping mismatches #167
Labels
checking
Issues around checking
enhancement
New feature or request
good-second-issue
Moderately difficult issue
When doing subtyping (initial declaration, assigning, passing argument as parameter, return type etc) the returned result is a SubTypeResult. The subtyping logic (in
types/subtyping.rs
) currently collects some of the reasons for mismatches when doing the checking and stores this as a NonEqualityReason.However this reason is thrown away in many places and does not make it to diagnostics. This can be shown by running
rg "SubTypeResult::IsNotSubType\(_"
.It would be better to pass this via a field to many of the diagnostics. For example here
ezno/checker/src/context/mod.rs
Lines 1115 to 1120 in 5191329
There should be something like
mismatch: MismatchExplanation
. This can be turned into a user readable explanation of why the type error happened. This can be surfaced via adding labels in theDiagnostic::PositionWithAdditionalLabels
.The text was updated successfully, but these errors were encountered: