Merge pull request #7497 from smores56/new-interpolation-syntax

Move to new interpolation syntax
This commit is contained in:
Sam Mohr 2025-01-10 15:25:12 -08:00 committed by GitHub
commit 528d1d2b69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 630 additions and 596 deletions

View file

@ -1,2 +1,2 @@
"""$(g)""":q
"""${g}""":q
f

View file

@ -1,5 +1,5 @@
"""
"""
"$(i
"${i
"""
""")"
"""}"

View file

@ -1 +1 @@
"""""""$(i"""""")"
"""""""${i""""""}"

View file

@ -1,8 +1,8 @@
"""
$({
${{
}
i)
$({
i}
${{
}
i)
i}
"""

View file

@ -1,4 +1,4 @@
"""$({
}i)
$({
}i)"""
"""${{
}i}
${{
}i}"""

View file

@ -3,5 +3,5 @@ main =
|> List.dropFirst 1
|> List.mapTry? Str.toU8
|> List.sum
|> \total -> "Sum of numbers: $(Num.to_str total)"
|> \total -> "Sum of numbers: ${Num.to_str total}"
|> Str.toUpper

View file

@ -6575,13 +6575,13 @@ mod test_fmt {
expr_formats_to(
indoc!(
"
x = \"foo:\u{200B} $(bar).\"
x = \"foo:\u{200B} ${bar}.\"
x
"
),
indoc!(
r#"
x = "foo:\u(200b) $(bar)."
x = "foo:\u(200b) ${bar}."
x
"#
),
@ -6595,7 +6595,7 @@ mod test_fmt {
"
x =
\"\"\"
foo:\u{200B} $(bar).
foo:\u{200B} ${bar}.
\"\"\"
x
"
@ -6604,7 +6604,7 @@ mod test_fmt {
r#"
x =
"""
foo:\u(200b) $(bar).
foo:\u(200b) ${bar}.
"""
x
"#

View file

@ -1036,7 +1036,7 @@ mod test_snapshots {
#[test]
fn string_with_interpolation_in_middle() {
assert_segments(r#""Hi, $(name)!""#, |arena| {
assert_segments(r#""Hi, ${name}!""#, |arena| {
let expr = arena.alloc(Var {
module_name: "",
ident: "name",
@ -1052,7 +1052,7 @@ mod test_snapshots {
#[test]
fn string_with_interpolation_in_front() {
assert_segments(r#""$(name), hi!""#, |arena| {
assert_segments(r#""${name}, hi!""#, |arena| {
let expr = arena.alloc(Var {
module_name: "",
ident: "name",
@ -1067,7 +1067,7 @@ mod test_snapshots {
#[test]
fn string_with_interpolation_in_back() {
assert_segments(r#""Hello $(name)""#, |arena| {
assert_segments(r#""Hello ${name}""#, |arena| {
let expr = arena.alloc(Var {
module_name: "",
ident: "name",
@ -1082,7 +1082,7 @@ mod test_snapshots {
#[test]
fn string_with_multiple_interpolations() {
assert_segments(r#""Hi, $(name)! How is $(project) going?""#, |arena| {
assert_segments(r#""Hi, ${name}! How is ${project} going?""#, |arena| {
let expr1 = arena.alloc(Var {
module_name: "",
ident: "name",