Coalesce even more annotation types

This commit is contained in:
Ayaz Hafiz 2022-10-25 12:01:03 -05:00
parent a6889a4f6d
commit e0a2139b1e
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -2657,11 +2657,9 @@ fn constrain_typed_function_arguments_simple(
let it = arguments.iter().zip(arg_types.iter()).enumerate();
for (index, ((pattern_var, annotated_mark, loc_pattern), ann)) in it {
let pattern_var_index = constraints.push_type(Variable(*pattern_var));
let ann_index = constraints.push_type(ann.clone());
if loc_pattern.value.surely_exhaustive() {
// TODO coalesce
let ann_index = constraints.push_type(ann.clone());
// OPT: we don't need to perform any type-level exhaustiveness checking.
// Check instead only that the pattern unifies with the annotation type.
let pattern_expected = PExpected::ForReason(
@ -2687,7 +2685,6 @@ fn constrain_typed_function_arguments_simple(
// this constraint must be to the def_pattern_state's constraints
def_pattern_state.vars.push(*pattern_var);
let ann_index = constraints.push_type(ann.clone());
let ann_expected =
constraints.push_expected_type(Expected::NoExpectation(ann_index));
let pattern_con = constraints.equal_types_var(
@ -2725,7 +2722,6 @@ fn constrain_typed_function_arguments_simple(
{
// Store the actual type in a variable.
let ann_index = constraints.push_type(ann.clone());
let expected_annotation =
constraints.push_expected_type(Expected::NoExpectation(ann_index));
argument_pattern_state