mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-02 13:58:50 +00:00
Fix as in apply type
This commit is contained in:
parent
bab5e65480
commit
7ba5135602
5 changed files with 69 additions and 2 deletions
|
|
@ -367,13 +367,13 @@ fn fmt_ty_ann(
|
|||
}
|
||||
|
||||
TypeAnnotation::As(lhs, spaces, TypeHeader { name, vars }) => {
|
||||
let write_parens = parens == Parens::InAsPattern;
|
||||
let write_parens = parens == Parens::InAsPattern || parens == Parens::InApply;
|
||||
|
||||
buf.indent(indent);
|
||||
if write_parens {
|
||||
buf.push('(')
|
||||
}
|
||||
|
||||
buf.indent(indent);
|
||||
let lhs_indent = buf.cur_line_indent();
|
||||
lhs.value
|
||||
.format_with_options(buf, Parens::InAsPattern, Newlines::No, indent);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
N : A (H as H) H
|
||||
I
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
@0-16 SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(0),
|
||||
],
|
||||
regions: [
|
||||
@0-14,
|
||||
],
|
||||
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: [
|
||||
Alias {
|
||||
header: TypeHeader {
|
||||
name: @0-1 "N",
|
||||
vars: [],
|
||||
},
|
||||
ann: @2-14 Apply(
|
||||
"",
|
||||
"A",
|
||||
[
|
||||
@5-0 As(
|
||||
@5-6 Apply(
|
||||
"",
|
||||
"H",
|
||||
[],
|
||||
),
|
||||
[],
|
||||
TypeHeader {
|
||||
name: @10-11 "H",
|
||||
vars: [],
|
||||
},
|
||||
),
|
||||
@13-14 Apply(
|
||||
"",
|
||||
"H",
|
||||
[],
|
||||
),
|
||||
],
|
||||
),
|
||||
},
|
||||
],
|
||||
value_defs: [],
|
||||
},
|
||||
@15-16 SpaceBefore(
|
||||
Tag(
|
||||
"I",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
N:A((H)as H) H
|
||||
I
|
||||
|
|
@ -436,6 +436,7 @@ mod test_snapshots {
|
|||
pass/function_with_tuple_ext_type.expr,
|
||||
pass/function_with_tuple_type.expr,
|
||||
pass/h_greater_comment_minus_div.expr,
|
||||
pass/h_parens_as_parens_h_ann.expr,
|
||||
pass/highest_float.expr,
|
||||
pass/highest_int.expr,
|
||||
pass/i_over_not_g.expr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue