Treat single quote literals as ranged numbers for inference purposes

This commit is contained in:
Ayaz Hafiz 2022-10-03 15:19:38 -05:00
parent 797763b5fa
commit 178b634266
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
10 changed files with 179 additions and 16 deletions

View file

@ -7841,4 +7841,49 @@ mod solve_expr {
"hasher -> hasher | hasher has Hasher",
);
}
#[test]
fn check_char_as_u8() {
infer_eq_without_problem(
indoc!(
r#"
x : U8
x = '.'
x
"#
),
"U8",
);
}
#[test]
fn check_char_as_u16() {
infer_eq_without_problem(
indoc!(
r#"
x : U16
x = '.'
x
"#
),
"U16",
);
}
#[test]
fn check_char_as_u32() {
infer_eq_without_problem(
indoc!(
r#"
x : U32
x = '.'
x
"#
),
"U32",
);
}
}