mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-24 02:21:21 +00:00
Fix negative float and non-base-10 literal patterns
This commit is contained in:
parent
962534e3d1
commit
f08a0012ea
5 changed files with 56 additions and 2 deletions
|
|
@ -294,7 +294,8 @@ fn fmt_pattern_only(
|
|||
is_negative,
|
||||
} => {
|
||||
buf.indent(indent);
|
||||
let needs_parens = parens == Parens::InClosurePattern;
|
||||
let needs_parens = parens == Parens::InClosurePattern
|
||||
|| (parens == Parens::InPncApplyFunc && *is_negative);
|
||||
if needs_parens {
|
||||
buf.push('(');
|
||||
}
|
||||
|
|
@ -317,7 +318,8 @@ fn fmt_pattern_only(
|
|||
}
|
||||
Pattern::FloatLiteral(string) => {
|
||||
buf.indent(indent);
|
||||
let needs_parens = parens == Parens::InClosurePattern;
|
||||
let needs_parens = parens == Parens::InClosurePattern
|
||||
|| (parens == Parens::InPncApplyFunc && string.starts_with('-'));
|
||||
if needs_parens {
|
||||
buf.push('(');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue