Skip to content

Commit

Permalink
Revise nested interpolation error message
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfeldman committed Jul 30, 2023
1 parent 9c9a788 commit 882e159
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
18 changes: 2 additions & 16 deletions crates/repl_test/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1376,25 +1376,11 @@ fn interpolation_with_nested_interpolation() {
4│ "foo \(Str.joinWith ["a\(Num.toStr 5)", "b"] "c")"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
String interpolation cannot contain newlines, comments, or nested
interpolations.
String interpolations cannot contain newlines or other interpolations.
You can learn more about string interpolation at
<https://www.roc-lang.org/tutorial#string-interpolation>
Enter an expression to evaluate, or a definition (like x = 1) to use in future expressions.
Unless there was a compile-time error, expressions get automatically named so you can refer to them later.
For example, if you see # val1 after an output, you can now refer to that expression as val1 in future expressions.
Tips:
- ctrl-v + ctrl-j makes a newline
- :q to quit
- :help"#
"#
),
);
}
2 changes: 1 addition & 1 deletion crates/reporting/src/error/canonicalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ pub fn can_problem<'b>(
doc = alloc.stack([
alloc.reflow("This string interpolation is invalid:"),
alloc.region(lines.convert_region(region)),
alloc.reflow(r"String interpolation cannot contain newlines, comments, or nested interpolations."),
alloc.reflow(r"String interpolations cannot contain newlines or other interpolations."),
alloc.reflow(r"You can learn more about string interpolation at <https://www.roc-lang.org/tutorial#string-interpolation>"),
]);

Expand Down

0 comments on commit 882e159

Please sign in to comment.