mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast: fix dumping sumtype of fntype (#15734)
This commit is contained in:
parent
550b27b014
commit
b4494f921a
@ -230,11 +230,9 @@ pub fn (t &Table) fn_type_signature(f &Fn) string {
|
||||
if f.return_type != 0 && f.return_type != void_type {
|
||||
sym := t.sym(f.return_type)
|
||||
opt := if f.return_type.has_flag(.optional) { 'option_' } else { '' }
|
||||
if sym.kind == .alias {
|
||||
sig += '__$opt$sym.cname'
|
||||
} else {
|
||||
sig += '__$opt$sym.kind'
|
||||
}
|
||||
res := if f.return_type.has_flag(.result) { 'result_' } else { '' }
|
||||
|
||||
sig += '__$opt$res$sym.cname'
|
||||
}
|
||||
return sig
|
||||
}
|
||||
|
1
vlib/v/tests/inout/dump_sumtype_of_fntype.out
Normal file
1
vlib/v/tests/inout/dump_sumtype_of_fntype.out
Normal file
@ -0,0 +1 @@
|
||||
[vlib/v/tests/inout/dump_sumtype_of_fntype.vv:10] main.MyFnSumtype(main.f): MyFnSumtype(fn (int) v.ast.Expr)
|
11
vlib/v/tests/inout/dump_sumtype_of_fntype.vv
Normal file
11
vlib/v/tests/inout/dump_sumtype_of_fntype.vv
Normal file
@ -0,0 +1,11 @@
|
||||
import v.ast
|
||||
|
||||
type MyFnSumtype = fn () | fn (int) ast.Expr
|
||||
|
||||
fn f(z int) ast.Expr {
|
||||
return ast.empty_expr
|
||||
}
|
||||
|
||||
fn main() {
|
||||
dump(MyFnSumtype(f))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user