Correct repl evaluation of toplevel numbers

Closes #5191
This commit is contained in:
Ayaz Hafiz 2023-04-12 10:18:32 -05:00
parent 77cf60b866
commit 250f4ea046
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 59 additions and 18 deletions

View file

@ -1212,4 +1212,42 @@ mod test {
),
);
}
#[test]
fn match_on_opaque_number_type() {
run_expect_test(
indoc!(
r#"
interface Test exposes [] imports []
hexToByte : U8, U8 -> U8
hexToByte = \upper, lower ->
Num.bitwiseOr (Num.shiftRightBy upper 4) lower
expect
actual = hexToByte 7 4
expected = 't'
actual == expected
"#
),
indoc!(
r#"
This expectation failed:
7> expect
8> actual = hexToByte 7 4
9> expected = 't'
10> actual == expected
When it failed, these variables had these values:
actual : U8
actual = 4
expected : Int Unsigned8
expected = 116
"#
),
);
}
}