Skip to content

Commit

Permalink
fmt: fix alias type stripped comments (#18346)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jun 4, 2023
1 parent 325f64b commit 5440657
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions vlib/v/fmt/tests/type_decl_comments_keep.vv
@@ -0,0 +1,4 @@
const a = 1 // foo

pub type Keycode = int // foo
type Keycode2 = f64 | int // foo
2 changes: 1 addition & 1 deletion vlib/v/parser/parser.v
Expand Up @@ -4118,7 +4118,7 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
p.error_with_pos('a type alias can not refer to itself: ${name}', decl_pos.extend(type_alias_pos))
return ast.AliasTypeDecl{}
}
comments = p.eat_comments(same_line: true)
comments = sum_variants[0].end_comments.clone()
return ast.AliasTypeDecl{
name: name
is_pub: is_pub
Expand Down

0 comments on commit 5440657

Please sign in to comment.