Get deep range numbers working

This commit is contained in:
Ayaz Hafiz 2022-07-04 18:02:35 -04:00 committed by ayazhafiz
parent 5a18490050
commit c154a337a9
No known key found for this signature in database
GPG key ID: B443F7A3030C9AED
17 changed files with 503 additions and 295 deletions

View file

@ -1855,7 +1855,7 @@ fn compact_lambda_set<P: Phase>(
| FlexVar(..)
| RecursionVar { .. }
| LambdaSet(..)
| RangedNumber(_, _) => {
| RangedNumber(_) => {
internal_error!("unexpected")
}
};
@ -2174,9 +2174,8 @@ fn type_to_variable<'a>(
Variable(_) | EmptyRec | EmptyTagUnion => {
unreachable!("This variant should never be deferred!")
}
RangedNumber(typ, range) => {
let ty_var = helper!(typ);
let content = Content::RangedNumber(ty_var, *range);
RangedNumber(range) => {
let content = Content::RangedNumber(*range);
register_with_known_var(subs, destination, rank, pools, content)
}
@ -3266,7 +3265,7 @@ fn adjust_rank_content(
rank
}
RangedNumber(typ, _) => adjust_rank(subs, young_mark, visit_mark, group_rank, *typ),
RangedNumber(_) => group_rank,
}
}
@ -3556,8 +3555,8 @@ fn deep_copy_var_help(
);
}
RangedNumber(typ, range) => {
let new_content = RangedNumber(work!(typ), range);
RangedNumber(range) => {
let new_content = RangedNumber(range);
subs.set_content_unchecked(copy, new_content);
}

View file

@ -1572,7 +1572,7 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
Foo "happy" 2020
Foo "happy" 12
"#
),
"[Foo Str (Num *)]*",
@ -2531,7 +2531,7 @@ mod solve_expr {
{ numIdentity, x : numIdentity 42, y }
"#
),
"{ numIdentity : Num a -> Num a, x : Num b, y : Float * }",
"{ numIdentity : Num a -> Num a, x : Num *, y : Float * }",
);
}
@ -3951,7 +3951,7 @@ mod solve_expr {
negatePoint { x: 1, y: 2.1, z: 0x3 }
"#
),
"{ x : Num a, y : Float *, z : Int * }",
"{ x : Num *, y : Float *, z : Int * }",
);
}
@ -3968,7 +3968,7 @@ mod solve_expr {
{ a, b }
"#
),
"{ a : { x : Num a, y : Float *, z : c }, b : { blah : Str, x : Num b, y : Float *, z : d } }",
"{ a : { x : Num *, y : Float *, z : c }, b : { blah : Str, x : Num *, y : Float *, z : a } }",
);
}