respect int/float precision in pattern matchs

This commit is contained in:
Folkert 2021-09-18 22:55:34 +02:00
parent cde9f97415
commit ada331567a
4 changed files with 153 additions and 66 deletions

View file

@ -1778,4 +1778,48 @@ mod gen_num {
u32
);
}
#[test]
fn when_on_i32() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [ main ] to "./platform"
x : I32
x = 0
main : I32
main =
when x is
0 -> 42
_ -> -1
"#
),
42,
i32
);
}
#[test]
fn when_on_i16() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [ main ] to "./platform"
x : I16
x = 0
main : I16
main =
when x is
0 -> 42
_ -> -1
"#
),
42,
i16
);
}
}