From 80d404c22089733109aa226abf31277ecfa04163 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+tobealive@users.noreply.github.com> Date: Sun, 28 May 2023 05:41:46 +0200 Subject: [PATCH] checker: replace `as` cast with a safer type check `is` (smart cast) (#18286) --- vlib/v/checker/fn.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index c479bf0362..33a37bba63 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -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'] {