mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
temporary fix for issue #2897
This commit is contained in:
parent
dbaa37ea46
commit
e63300e286
@ -446,7 +446,7 @@ fn (table mut Table) add_default_val(idx int, type_name, val_expr string) {
|
|||||||
mut t := table.typesmap[type_name]
|
mut t := table.typesmap[type_name]
|
||||||
if t.default_vals.len == 0 {
|
if t.default_vals.len == 0 {
|
||||||
t.default_vals = [''].repeat(t.fields.len)
|
t.default_vals = [''].repeat(t.fields.len)
|
||||||
}
|
}
|
||||||
t.default_vals[idx] = val_expr
|
t.default_vals[idx] = val_expr
|
||||||
table.typesmap[type_name] = t
|
table.typesmap[type_name] = t
|
||||||
}
|
}
|
||||||
@ -696,7 +696,7 @@ fn (p mut Parser) check_types2(got_, expected_ string, throw bool) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expected = expected.replace('*', '')
|
expected = expected.replace('*', '')
|
||||||
got = got.replace('*', '')
|
got = got.replace('*', '').replace('ptr','')
|
||||||
if got != expected {
|
if got != expected {
|
||||||
// Interface check
|
// Interface check
|
||||||
if expected.ends_with('er') {
|
if expected.ends_with('er') {
|
||||||
|
18
vlib/compiler/tests/multiret_with_ptrtype.v
Normal file
18
vlib/compiler/tests/multiret_with_ptrtype.v
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
fn multi_voidptr_ret() (voidptr, bool) {
|
||||||
|
return voidptr(0), true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn multi_byteptr_ret() (byteptr, bool) {
|
||||||
|
return byteptr(0), true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_multi_ptrtype_ret() {
|
||||||
|
a, b := multi_voidptr_ret()
|
||||||
|
assert a == voidptr(0)
|
||||||
|
assert b == true
|
||||||
|
|
||||||
|
c, d := multi_byteptr_ret()
|
||||||
|
assert c == byteptr(0)
|
||||||
|
assert d == true
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user