1
0
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:
Turiiya 2023-05-28 05:41:46 +02:00 committed by GitHub
parent 9db10c8f61
commit 80d404c220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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'] {