vfmt: fix `struct Abc { field fn() ? }`
parent
7feb53b605
commit
04757a4853
|
@ -0,0 +1,4 @@
|
|||
struct FieldsWithOptionalVoidReturnType {
|
||||
f fn () ?
|
||||
g fn () ?
|
||||
}
|
|
@ -120,7 +120,9 @@ pub fn (t &Table) fn_type_source_signature(f &Fn) string {
|
|||
}
|
||||
}
|
||||
sig += ')'
|
||||
if f.return_type != void_type {
|
||||
if f.return_type == ovoid_type {
|
||||
sig += ' ?'
|
||||
} else if f.return_type != void_type {
|
||||
return_type_sym := t.get_type_symbol(f.return_type)
|
||||
sig += ' $return_type_sym.name'
|
||||
}
|
||||
|
|
|
@ -335,6 +335,7 @@ pub const (
|
|||
|
||||
pub const (
|
||||
void_type = new_type(void_type_idx)
|
||||
ovoid_type = new_type(void_type_idx).set_flag(.optional) // the return type of `fn () ?`
|
||||
voidptr_type = new_type(voidptr_type_idx)
|
||||
byteptr_type = new_type(byteptr_type_idx)
|
||||
charptr_type = new_type(charptr_type_idx)
|
||||
|
|
Loading…
Reference in New Issue