fix bug parser with comment after ':' in signature

This commit is contained in:
Sébastien Besnier 2020-11-25 10:31:49 +01:00
parent 29c1dc35de
commit 124800f8b9
2 changed files with 40 additions and 2 deletions

View file

@ -544,7 +544,7 @@ fn annotation<'a>(
ascii_char(b':'),
// Spaces after the ':' (at a normal indentation level) and then the type.
// The type itself must be indented more than the pattern and ':'
space0_before(type_annotation::located(indented_more), indented_more)
space0_before(type_annotation::located(indented_more), min_indent)
)
)
}
@ -835,7 +835,7 @@ fn parse_def_signature<'a>(
// It should be indented more than the original, and it will
// end when outdented again.
and_then_with_indent_level(
type_annotation::located(indented_more),
space0_before(type_annotation::located(indented_more), min_indent),
// The first annotation may be immediately (spaces_then_comment_or_newline())
// followed by a body at the exact same indent_level
// leading to an AnnotatedBody in this case