mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast, parser: fix reference typenode (#15346)
This commit is contained in:
parent
e034b35144
commit
9e50803071
@ -112,8 +112,9 @@ pub type Node = CallArg
|
||||
|
||||
pub struct TypeNode {
|
||||
pub:
|
||||
typ Type
|
||||
pos token.Pos
|
||||
pub mut:
|
||||
typ Type
|
||||
}
|
||||
|
||||
pub enum ComptimeTypeKind {
|
||||
|
@ -607,6 +607,10 @@ fn (mut p Parser) prefix_expr() ast.Expr {
|
||||
right = right.expr
|
||||
}
|
||||
}
|
||||
if mut right is ast.TypeNode {
|
||||
right.typ = right.typ.ref()
|
||||
return right
|
||||
}
|
||||
}
|
||||
mut or_stmts := []ast.Stmt{}
|
||||
mut or_kind := ast.OrKind.absent
|
||||
|
1
vlib/v/tests/inout/printing_comptime_if.out
Normal file
1
vlib/v/tests/inout/printing_comptime_if.out
Normal file
@ -0,0 +1 @@
|
||||
T is &u8
|
10
vlib/v/tests/inout/printing_comptime_if.vv
Normal file
10
vlib/v/tests/inout/printing_comptime_if.vv
Normal file
@ -0,0 +1,10 @@
|
||||
fn main() {
|
||||
c := c'cstr'
|
||||
proc(c)
|
||||
}
|
||||
|
||||
fn proc<T>(input T) {
|
||||
$if T is &u8 {
|
||||
println('T is $T.name')
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user