mirror of
https://github.com/roc-lang/roc.git
synced 2024-10-04 14:17:28 +03:00
Fix auto-fixing of deprecated interpolated strings
This commit is contained in:
parent
e10448e92c
commit
4e8b36adbf
@ -593,7 +593,7 @@ impl<'a> RemoveSpaces<'a> for StrSegment<'a> {
|
||||
StrSegment::EscapedChar(c) => StrSegment::EscapedChar(c),
|
||||
StrSegment::Interpolated(t) => StrSegment::Interpolated(t.remove_spaces(arena)),
|
||||
StrSegment::DeprecatedInterpolated(t) => {
|
||||
StrSegment::DeprecatedInterpolated(t.remove_spaces(arena))
|
||||
StrSegment::Interpolated(t.remove_spaces(arena))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
"$(e)"
|
@ -0,0 +1,17 @@
|
||||
SpaceAfter(
|
||||
Str(
|
||||
Line(
|
||||
[
|
||||
DeprecatedInterpolated(
|
||||
@3-4 Var {
|
||||
module_name: "",
|
||||
ident: "e",
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
@ -0,0 +1 @@
|
||||
"\(e)"
|
@ -0,0 +1,8 @@
|
||||
main =
|
||||
Arg.list! {}
|
||||
|> List.dropFirst 1
|
||||
|> List.mapTry Str.toU8
|
||||
|> Task.fromResult!
|
||||
|> List.sum
|
||||
|> \total -> "Sum of numbers: $(Num.toStr total)"
|
||||
|> Stdout.line!
|
@ -0,0 +1,168 @@
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-189,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 1),
|
||||
],
|
||||
spaces: [
|
||||
Newline,
|
||||
],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier {
|
||||
ident: "main",
|
||||
},
|
||||
@11-189 SpaceBefore(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@11-23 SpaceAfter(
|
||||
Apply(
|
||||
@11-19 TaskAwaitBang(
|
||||
Var {
|
||||
module_name: "Arg",
|
||||
ident: "list",
|
||||
},
|
||||
),
|
||||
[
|
||||
@21-23 Record(
|
||||
[],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@28-30 Pizza,
|
||||
),
|
||||
(
|
||||
@31-47 SpaceAfter(
|
||||
Apply(
|
||||
@31-45 Var {
|
||||
module_name: "List",
|
||||
ident: "dropFirst",
|
||||
},
|
||||
[
|
||||
@46-47 Num(
|
||||
"1",
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@52-54 Pizza,
|
||||
),
|
||||
(
|
||||
@55-75 SpaceAfter(
|
||||
Apply(
|
||||
@55-66 Var {
|
||||
module_name: "List",
|
||||
ident: "mapTry",
|
||||
},
|
||||
[
|
||||
@67-75 Var {
|
||||
module_name: "Str",
|
||||
ident: "toU8",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@80-82 Pizza,
|
||||
),
|
||||
(
|
||||
@83-98 SpaceAfter(
|
||||
TaskAwaitBang(
|
||||
Var {
|
||||
module_name: "Task",
|
||||
ident: "fromResult",
|
||||
},
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@104-106 Pizza,
|
||||
),
|
||||
(
|
||||
@107-115 SpaceAfter(
|
||||
Var {
|
||||
module_name: "List",
|
||||
ident: "sum",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@120-122 Pizza,
|
||||
),
|
||||
(
|
||||
@123-169 SpaceAfter(
|
||||
Closure(
|
||||
[
|
||||
@124-129 Identifier {
|
||||
ident: "total",
|
||||
},
|
||||
],
|
||||
@133-169 Str(
|
||||
Line(
|
||||
[
|
||||
Plaintext(
|
||||
"Sum of numbers: ",
|
||||
),
|
||||
Interpolated(
|
||||
@152-167 Apply(
|
||||
@152-161 Var {
|
||||
module_name: "Num",
|
||||
ident: "toStr",
|
||||
},
|
||||
[
|
||||
@162-167 Var {
|
||||
module_name: "",
|
||||
ident: "total",
|
||||
},
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@174-176 Pizza,
|
||||
),
|
||||
],
|
||||
@177-188 TaskAwaitBang(
|
||||
Var {
|
||||
module_name: "Stdout",
|
||||
ident: "line",
|
||||
},
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
main =
|
||||
Arg.list! {}
|
||||
|> List.dropFirst 1
|
||||
|> List.mapTry Str.toU8
|
||||
|> Task.fromResult!
|
||||
|> List.sum
|
||||
|> \total -> "Sum of numbers: $(Num.toStr total)"
|
||||
|> Stdout.line!
|
@ -304,6 +304,7 @@ mod test_snapshots {
|
||||
pass/dbg.expr,
|
||||
pass/dbg_multiline.expr,
|
||||
pass/defs_suffixed_middle_extra_indents.moduledefs,
|
||||
pass/deprecated_interpolated_string.expr,
|
||||
pass/destructure_tag_assignment.expr,
|
||||
pass/docs.expr,
|
||||
pass/empty_app_header.header,
|
||||
@ -438,6 +439,7 @@ mod test_snapshots {
|
||||
pass/pattern_as_list_rest.expr,
|
||||
pass/pattern_as_spaces.expr,
|
||||
pass/pattern_with_space_in_parens.expr, // https://github.com/roc-lang/roc/issues/929
|
||||
pass/pizza_bang.moduledefs,
|
||||
pass/plus_if.expr,
|
||||
pass/plus_when.expr,
|
||||
pass/pos_inf_float.expr,
|
||||
|
Loading…
Reference in New Issue
Block a user