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:
parent
325f64bc60
commit
5440657364
4
vlib/v/fmt/tests/type_decl_comments_keep.vv
Normal file
4
vlib/v/fmt/tests/type_decl_comments_keep.vv
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
const a = 1 // foo
|
||||||
|
|
||||||
|
pub type Keycode = int // foo
|
||||||
|
type Keycode2 = f64 | int // foo
|
@ -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))
|
p.error_with_pos('a type alias can not refer to itself: ${name}', decl_pos.extend(type_alias_pos))
|
||||||
return ast.AliasTypeDecl{}
|
return ast.AliasTypeDecl{}
|
||||||
}
|
}
|
||||||
comments = p.eat_comments(same_line: true)
|
comments = sum_variants[0].end_comments.clone()
|
||||||
return ast.AliasTypeDecl{
|
return ast.AliasTypeDecl{
|
||||||
name: name
|
name: name
|
||||||
is_pub: is_pub
|
is_pub: is_pub
|
||||||
|
Loading…
Reference in New Issue
Block a user