1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: fix alias type stripped comments (#18346)

This commit is contained in:
Felipe Pena 2023-06-04 20:53:17 -03:00 committed by GitHub
parent 325f64bc60
commit 5440657364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
const a = 1 // foo
pub type Keycode = int // foo
type Keycode2 = f64 | int // foo

View File

@ -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