feat: prefix tuples with hash again cause ambguity with call
This commit is contained in:
@@ -377,9 +377,12 @@ impl<'comments> Formatter<'comments> {
|
||||
..
|
||||
} => docvec![module, ".", name],
|
||||
|
||||
Constant::Tuple { elements, .. } => {
|
||||
wrap_args(elements.iter().map(|e| (self.const_expr(e), false))).group()
|
||||
}
|
||||
Constant::Tuple { elements, .. } => "#"
|
||||
.to_doc()
|
||||
.append(wrap_args(
|
||||
elements.iter().map(|e| (self.const_expr(e), false)),
|
||||
))
|
||||
.group(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,9 +465,9 @@ impl<'comments> Formatter<'comments> {
|
||||
.append(break_("", " ").append(self.annotation(retrn)).nest(INDENT)),
|
||||
|
||||
Annotation::Var { name, .. } => name.to_doc(),
|
||||
Annotation::Tuple { elems, .. } => {
|
||||
wrap_args(elems.iter().map(|t| (self.annotation(t), false)))
|
||||
}
|
||||
Annotation::Tuple { elems, .. } => "#"
|
||||
.to_doc()
|
||||
.append(wrap_args(elems.iter().map(|t| (self.annotation(t), false)))),
|
||||
}
|
||||
.group()
|
||||
}
|
||||
@@ -783,9 +786,10 @@ impl<'comments> Formatter<'comments> {
|
||||
..
|
||||
} => self.record_update(constructor, spread, args),
|
||||
|
||||
UntypedExpr::Tuple { elems, .. } => {
|
||||
wrap_args(elems.iter().map(|e| (self.wrap_expr(e), false))).group()
|
||||
}
|
||||
UntypedExpr::Tuple { elems, .. } => "#"
|
||||
.to_doc()
|
||||
.append(wrap_args(elems.iter().map(|e| (self.wrap_expr(e), false))))
|
||||
.group(),
|
||||
};
|
||||
commented(document, comments)
|
||||
}
|
||||
@@ -1349,9 +1353,10 @@ impl<'comments> Formatter<'comments> {
|
||||
|
||||
Pattern::Discard { name, .. } => name.to_doc(),
|
||||
|
||||
Pattern::Tuple { elems, .. } => {
|
||||
wrap_args(elems.iter().map(|e| (self.pattern(e), false))).group()
|
||||
}
|
||||
Pattern::Tuple { elems, .. } => "#"
|
||||
.to_doc()
|
||||
.append(wrap_args(elems.iter().map(|e| (self.pattern(e), false))))
|
||||
.group(),
|
||||
|
||||
Pattern::List { elements, tail, .. } => {
|
||||
let elements_document =
|
||||
|
||||
@@ -336,11 +336,13 @@ fn constant_value_parser() -> impl Parser<Token, ast::UntypedConstant, Error = P
|
||||
}
|
||||
});
|
||||
|
||||
let constant_tuple_parser = r
|
||||
.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen))
|
||||
let constant_tuple_parser = just(Token::Hash)
|
||||
.ignore_then(
|
||||
r.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen)),
|
||||
)
|
||||
.map_with_span(|elements, span| ast::UntypedConstant::Tuple {
|
||||
location: span,
|
||||
elements,
|
||||
@@ -849,11 +851,13 @@ pub fn expr_parser(
|
||||
label,
|
||||
});
|
||||
|
||||
let tuple = r
|
||||
.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen))
|
||||
let tuple = just(Token::Hash)
|
||||
.ignore_then(
|
||||
r.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen)),
|
||||
)
|
||||
.map_with_span(|elems, span| expr::UntypedExpr::Tuple {
|
||||
location: span,
|
||||
elems,
|
||||
@@ -1298,10 +1302,13 @@ pub fn type_parser() -> impl Parser<Token, ast::Annotation, Error = ParseError>
|
||||
}
|
||||
}),
|
||||
// Tuple
|
||||
r.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen))
|
||||
just(Token::Hash)
|
||||
.ignore_then(
|
||||
r.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen)),
|
||||
)
|
||||
.map_with_span(|elems, span| ast::Annotation::Tuple {
|
||||
location: span,
|
||||
elems,
|
||||
@@ -1522,10 +1529,13 @@ pub fn pattern_parser() -> impl Parser<Token, ast::UntypedPattern, Error = Parse
|
||||
value,
|
||||
}
|
||||
}),
|
||||
r.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen))
|
||||
just(Token::Hash)
|
||||
.ignore_then(
|
||||
r.clone()
|
||||
.separated_by(just(Token::Comma))
|
||||
.allow_trailing()
|
||||
.delimited_by(just(Token::LeftParen), just(Token::RightParen)),
|
||||
)
|
||||
.map_with_span(|elems, span| ast::UntypedPattern::Tuple {
|
||||
location: span,
|
||||
elems,
|
||||
|
||||
Reference in New Issue
Block a user