mirror of
https://github.com/vlang/v.git
synced 2025-09-07 14:20:10 -04:00
fmt: fix eating the attribute from @[deprecated] pub type Alias = int
(fix #24968), workaround -usecache bug (#24969)
This commit is contained in:
parent
73db18bc0d
commit
6fb46cc30f
@ -131,12 +131,19 @@ fn build_fast_tcc() {
|
|||||||
|
|
||||||
fn v_self_compilation_usecache_tcc() {
|
fn v_self_compilation_usecache_tcc() {
|
||||||
exec('unset VFLAGS')
|
exec('unset VFLAGS')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('v -usecache examples/hello_world.v')
|
exec('v -usecache examples/hello_world.v')
|
||||||
exec('./examples/hello_world')
|
exec('./examples/hello_world')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('v -o v2 -usecache cmd/v')
|
exec('v -o v2 -usecache cmd/v')
|
||||||
exec('./v2 -o v3 -usecache cmd/v')
|
exec('./v2 -o v3 -usecache cmd/v')
|
||||||
exec('./v3 version')
|
exec('./v3 version')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('./v3 -o tetris -usecache examples/tetris/tetris.v')
|
exec('./v3 -o tetris -usecache examples/tetris/tetris.v')
|
||||||
|
exec('rm -f ./examples/hello_world v2 v3 tetris')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_password_input_tcc() {
|
fn test_password_input_tcc() {
|
||||||
@ -198,13 +205,18 @@ fn v_self_compilation_gcc() {
|
|||||||
fn v_self_compilation_usecache_gcc() {
|
fn v_self_compilation_usecache_gcc() {
|
||||||
exec('unset VFLAGS')
|
exec('unset VFLAGS')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('v -usecache examples/hello_world.v')
|
exec('v -usecache examples/hello_world.v')
|
||||||
exec('examples/hello_world')
|
exec('examples/hello_world')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('v -o v2 -usecache cmd/v')
|
exec('v -o v2 -usecache cmd/v')
|
||||||
exec('./v2 -o v3 -usecache cmd/v')
|
exec('./v2 -o v3 -usecache cmd/v')
|
||||||
exec('./v3 version')
|
exec('./v3 version')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('./v3 -o tetris -usecache examples/tetris/tetris.v')
|
exec('./v3 -o tetris -usecache examples/tetris/tetris.v')
|
||||||
|
exec('rm -f ./examples/hello_world v2 v3 tetris')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn verify_v_test_works_gcc() {
|
fn verify_v_test_works_gcc() {
|
||||||
@ -312,11 +324,17 @@ fn v_self_compilation_clang() {
|
|||||||
|
|
||||||
fn v_self_compilation_usecache_clang() {
|
fn v_self_compilation_usecache_clang() {
|
||||||
exec('unset VFLAGS')
|
exec('unset VFLAGS')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('v -usecache examples/hello_world.v')
|
exec('v -usecache examples/hello_world.v')
|
||||||
exec('./examples/hello_world')
|
exec('./examples/hello_world')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('v -o v2 -usecache cmd/v')
|
exec('v -o v2 -usecache cmd/v')
|
||||||
exec('./v2 -o v3 -usecache cmd/v')
|
exec('./v2 -o v3 -usecache cmd/v')
|
||||||
exec('./v3 version')
|
exec('./v3 version')
|
||||||
|
|
||||||
|
exec('v wipe-cache')
|
||||||
exec('./v3 -o tetris -usecache examples/tetris/tetris.v')
|
exec('./v3 -o tetris -usecache examples/tetris/tetris.v')
|
||||||
exec('rm -f ./examples/hello_world v2 v3 tetris')
|
exec('rm -f ./examples/hello_world v2 v3 tetris')
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ module time
|
|||||||
// A lot of these are taken from the Go library.
|
// A lot of these are taken from the Go library.
|
||||||
pub type Duration = i64
|
pub type Duration = i64
|
||||||
|
|
||||||
|
@[markused]
|
||||||
pub const nanosecond = Duration(1)
|
pub const nanosecond = Duration(1)
|
||||||
pub const microsecond = Duration(1000 * nanosecond)
|
pub const microsecond = Duration(1000 * nanosecond)
|
||||||
pub const millisecond = Duration(1000 * microsecond)
|
pub const millisecond = Duration(1000 * microsecond)
|
||||||
|
@ -1483,6 +1483,7 @@ pub:
|
|||||||
pos token.Pos
|
pos token.Pos
|
||||||
type_pos token.Pos
|
type_pos token.Pos
|
||||||
comments []Comment
|
comments []Comment
|
||||||
|
attrs []Attr // attributes like @[deprecated] etc
|
||||||
pub mut:
|
pub mut:
|
||||||
parent_type Type
|
parent_type Type
|
||||||
is_markused bool
|
is_markused bool
|
||||||
|
@ -1686,6 +1686,7 @@ pub fn (mut f Fmt) type_decl(node ast.TypeDecl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut f Fmt) alias_type_decl(node ast.AliasTypeDecl) {
|
pub fn (mut f Fmt) alias_type_decl(node ast.AliasTypeDecl) {
|
||||||
|
f.attrs(node.attrs)
|
||||||
if node.is_pub {
|
if node.is_pub {
|
||||||
f.write('pub ')
|
f.write('pub ')
|
||||||
}
|
}
|
||||||
|
@ -30,3 +30,7 @@ enum Example {
|
|||||||
value1 = 1
|
value1 = 1
|
||||||
value1_again = 1
|
value1_again = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@[deprecated: 'use Example instead']
|
||||||
|
@[deprecated_after: '2040-01-24']
|
||||||
|
pub type Alias = Example
|
||||||
|
@ -2749,6 +2749,7 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
|
|||||||
return ast.AliasTypeDecl{}
|
return ast.AliasTypeDecl{}
|
||||||
}
|
}
|
||||||
comments = sum_variants[0].end_comments.clone()
|
comments = sum_variants[0].end_comments.clone()
|
||||||
|
p.attrs = []
|
||||||
return ast.AliasTypeDecl{
|
return ast.AliasTypeDecl{
|
||||||
name: name
|
name: name
|
||||||
is_pub: is_pub
|
is_pub: is_pub
|
||||||
@ -2758,6 +2759,7 @@ fn (mut p Parser) type_decl() ast.TypeDecl {
|
|||||||
pos: decl_pos
|
pos: decl_pos
|
||||||
comments: comments
|
comments: comments
|
||||||
is_markused: attrs.contains('markused')
|
is_markused: attrs.contains('markused')
|
||||||
|
attrs: attrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user