mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Constrain string interpolation
This commit is contained in:
parent
5080a7e24b
commit
274e7e786d
11 changed files with 150 additions and 180 deletions
|
@ -277,21 +277,53 @@ mod solve_expr {
|
|||
);
|
||||
}
|
||||
|
||||
// // INTERPOLATED STRING
|
||||
// INTERPOLATED STRING
|
||||
|
||||
// #[test]
|
||||
// fn infer_interpolated_string() {
|
||||
// infer_eq(
|
||||
// indoc!(
|
||||
// r#"
|
||||
// whatItIs = "great"
|
||||
#[test]
|
||||
fn infer_interpolated_string() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
whatItIs = "great"
|
||||
|
||||
// "type inference is \(whatItIs)!"
|
||||
// "#
|
||||
// ),
|
||||
// "Str",
|
||||
// );
|
||||
// }
|
||||
"type inference is \(whatItIs)!"
|
||||
"#
|
||||
),
|
||||
"Str",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_interpolated_var() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
whatItIs = "great"
|
||||
|
||||
str = "type inference is \(whatItIs)!"
|
||||
|
||||
whatItIs
|
||||
"#
|
||||
),
|
||||
"Str",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_interpolated_field() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
rec = { whatItIs: "great" }
|
||||
|
||||
str = "type inference is \(rec.whatItIs)!"
|
||||
|
||||
rec
|
||||
"#
|
||||
),
|
||||
"{ whatItIs : Str }",
|
||||
);
|
||||
}
|
||||
|
||||
// LIST MISMATCH
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue