mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: allow fixed array to pointer and vice versa when translated (#14275)
This commit is contained in:
parent
04a77c731e
commit
146051b231
@ -43,6 +43,18 @@ pub fn (mut c Checker) check_types(got ast.Type, expected ast.Type) bool {
|
|||||||
// Allow fixed arrays as `&i8` etc
|
// Allow fixed arrays as `&i8` etc
|
||||||
if expected_sym.is_number() {
|
if expected_sym.is_number() {
|
||||||
return true
|
return true
|
||||||
|
} else if expected.is_any_kind_of_pointer() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if expected_sym.kind == .array_fixed {
|
||||||
|
if got_sym.is_number() && got.is_any_kind_of_pointer() {
|
||||||
|
return true
|
||||||
|
} else if got_sym.kind == .array {
|
||||||
|
info := expected_sym.info as ast.ArrayFixed
|
||||||
|
info2 := got_sym.info as ast.Array
|
||||||
|
if c.check_types(info.elem_type, info2.elem_type) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if expected_sym.kind == .enum_ && got_sym.is_number() {
|
if expected_sym.kind == .enum_ && got_sym.is_number() {
|
||||||
|
Loading…
Reference in New Issue
Block a user