mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
force interpolated variables to be of type string
This commit is contained in:
parent
fec42d8654
commit
21b540751a
3 changed files with 72 additions and 11 deletions
|
@ -813,6 +813,32 @@ fn list_get_negative_index() {
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes!
|
||||
#[test]
|
||||
fn invalid_string_interpolation() {
|
||||
expect_failure(
|
||||
"\"$(123)\"",
|
||||
indoc!(
|
||||
r#"
|
||||
── TYPE MISMATCH ───────────────────────────────────────────────────────────────
|
||||
|
||||
This argument to this string interpolation has an unexpected type:
|
||||
|
||||
4│ "$(123)"
|
||||
^^^
|
||||
|
||||
The argument is a number of type:
|
||||
|
||||
Num *
|
||||
|
||||
But this string interpolation needs its argument to be:
|
||||
|
||||
Str
|
||||
"#
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_2149_i8_ok() {
|
||||
expect_success(r#"Str.toI8 "127""#, "Ok 127 : Result I8 [InvalidNumStr]");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue