mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 13:34:15 +00:00
Fix multiline pattern in body, which may only apply to multiline strings
This commit is contained in:
parent
ab4c96bc81
commit
2098ccd137
6 changed files with 81 additions and 3 deletions
|
|
@ -1011,7 +1011,13 @@ pub fn fmt_body<'a>(
|
|||
}
|
||||
|
||||
pattern.format_with_options(buf, Parens::InApply, Newlines::No, indent);
|
||||
|
||||
if pattern.is_multiline() {
|
||||
buf.ensure_ends_with_newline();
|
||||
buf.indent(indent);
|
||||
} else {
|
||||
buf.spaces(1);
|
||||
}
|
||||
buf.push_str("=");
|
||||
|
||||
let body = expr_lift_and_lower(Parens::NotNeeded, buf.text.bump(), body);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
(H
|
||||
"""
|
||||
""")
|
||||
= f
|
||||
"""
|
||||
"""
|
||||
f!
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-15,
|
||||
],
|
||||
space_before: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||
],
|
||||
space_after: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-7 Apply(
|
||||
@0-1 Tag(
|
||||
"H",
|
||||
),
|
||||
[
|
||||
@1-7 StrLiteral(
|
||||
Block(
|
||||
[],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@8-15 Apply(
|
||||
@8-9 Var {
|
||||
module_name: "",
|
||||
ident: "f",
|
||||
},
|
||||
[
|
||||
@9-15 Str(
|
||||
Block(
|
||||
[],
|
||||
),
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@16-18 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "f!",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
H""""""=f""""""
|
||||
f!
|
||||
|
|
@ -615,6 +615,7 @@ mod test_snapshots {
|
|||
pass/ten_times_eleven.expr,
|
||||
pass/three_arg_closure.expr,
|
||||
pass/triple_paren_pat_ann.expr,
|
||||
pass/triple_quote_craziness.expr,
|
||||
pass/try_blank_in_list.expr,
|
||||
pass/try_function_after_pipe.expr,
|
||||
pass/try_pipe_suffix.expr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue