When simplifying match types, ensure fully defined before reducing #11980
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.
Fixes #11977
Previously the match types were more often fully defined because inlining at Typer
caused more situations where type variables were instantiated. Now that inlining
is done later, we need to compensate. I believe it's a good idea anyway since it
means we can reduce more match types.
The weird widening from
Int
toLong
in #11977 happened because the original match type was unreduced, so the original expression was judged as non-conforming. So Typer searched for an implicit conversion. But every conversion forced the matchtype to be fully defined and therefore reducible, so every implicit conversion to a wider numeric type succeeded. Then the smallest target was chosen: i.e. Int -> Long, or Long -> Float.