mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: replace as
cast with a safer type check is
(smart cast) (#18286)
This commit is contained in:
parent
9db10c8f61
commit
80d404c220
@ -1517,8 +1517,8 @@ fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type {
|
||||
&& method_name in ['clone', 'keys', 'values', 'move', 'delete'] {
|
||||
if left_sym.kind == .map {
|
||||
return c.map_builtin_method_call(mut node, left_type, c.table.sym(left_type))
|
||||
} else {
|
||||
parent_type := (left_sym.info as ast.Alias).parent_type
|
||||
} else if left_sym.info is ast.Alias {
|
||||
parent_type := left_sym.info.parent_type
|
||||
return c.map_builtin_method_call(mut node, parent_type, c.table.final_sym(left_type))
|
||||
}
|
||||
} else if left_sym.kind == .array && method_name in ['insert', 'prepend'] {
|
||||
|
Loading…
Reference in New Issue
Block a user