Merge branch 'main' into fix-deprecated-interpolated-formatting

This commit is contained in:
Joshua Warner 2024-07-29 17:40:23 -07:00 committed by GitHub
commit ca037c5d0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 4321 additions and 127 deletions

View file

@ -801,7 +801,7 @@ pub enum ValueDef<'a> {
AnnotatedBody {
ann_pattern: &'a Loc<Pattern<'a>>,
ann_type: &'a Loc<TypeAnnotation<'a>>,
comment: Option<&'a str>,
lines_between: &'a [CommentOrNewline<'a>],
body_pattern: &'a Loc<Pattern<'a>>,
body_expr: &'a Loc<Expr<'a>>,
},
@ -1044,7 +1044,7 @@ impl<'a, 'b> Iterator for RecursiveValueDefIter<'a, 'b> {
ValueDef::AnnotatedBody {
ann_pattern: _,
ann_type: _,
comment: _,
lines_between: _,
body_pattern: _,
body_expr,
} => self.push_pending_from_expr(&body_expr.value),
@ -2726,7 +2726,7 @@ impl<'a> Malformed for ValueDef<'a> {
ValueDef::AnnotatedBody {
ann_pattern,
ann_type,
comment: _,
lines_between: _,
body_pattern,
body_expr,
} => {

View file

@ -3166,9 +3166,7 @@ fn stmts_to_defs<'a>(
let value_def = ValueDef::AnnotatedBody {
ann_pattern: arena.alloc(ann_pattern),
ann_type: arena.alloc(ann_type),
comment: spaces_middle
.first() // TODO: Why do we drop all but the first comment????
.and_then(crate::ast::CommentOrNewline::comment_str),
lines_between: spaces_middle,
body_pattern: loc_pattern,
body_expr: loc_def_expr,
};
@ -3213,9 +3211,7 @@ pub fn join_alias_to_body<'a>(
ValueDef::AnnotatedBody {
ann_pattern: arena.alloc(loc_ann_pattern),
ann_type: arena.alloc(ann_type),
comment: spaces_middle
.first() // TODO: Why do we drop all but the first comment????
.and_then(crate::ast::CommentOrNewline::comment_str),
lines_between: spaces_middle,
body_pattern,
body_expr,
}

View file

@ -397,13 +397,13 @@ impl<'a> RemoveSpaces<'a> for ValueDef<'a> {
AnnotatedBody {
ann_pattern,
ann_type,
comment: _,
lines_between: _,
body_pattern,
body_expr,
} => AnnotatedBody {
ann_pattern: arena.alloc(ann_pattern.remove_spaces(arena)),
ann_type: arena.alloc(ann_type.remove_spaces(arena)),
comment: None,
lines_between: &[],
body_pattern: arena.alloc(body_pattern.remove_spaces(arena)),
body_expr: arena.alloc(body_expr.remove_spaces(arena)),
},