diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 444b18d2f3..7c9ceb6b90 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -36,9 +36,11 @@ pub const ( valid_comptime_not_user_defined = all_valid_comptime_idents() array_builtin_methods = ['filter', 'clone', 'repeat', 'reverse', 'map', 'slice', 'sort', 'contains', 'index', 'wait', 'any', 'all', 'first', 'last', 'pop'] + array_builtin_methods_chk = token.new_keywords_matcher_from_array_trie(array_builtin_methods) // TODO: remove `byte` from this list when it is no longer supported reserved_type_names = ['byte', 'bool', 'char', 'i8', 'i16', 'int', 'i64', 'u8', 'u16', 'u32', 'u64', 'f32', 'f64', 'map', 'string', 'rune'] + reserved_type_names_chk = token.new_keywords_matcher_from_array_trie(reserved_type_names) vroot_is_deprecated_message = '@VROOT is deprecated, use @VMODROOT or @VEXEROOT instead' ) diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index c182e9e6e3..3994c403c5 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -1154,7 +1154,7 @@ pub fn (mut c Checker) method_call(mut node ast.CallExpr) ast.Type { } // TODO: remove this for actual methods, use only for compiler magic // FIXME: Argument count != 1 will break these - if left_sym.kind == .array && method_name in array_builtin_methods { + if left_sym.kind == .array && array_builtin_methods_chk.matches(method_name) { return c.array_builtin_method_call(mut node, left_type, c.table.sym(left_type)) } else if (left_sym.kind == .map || final_left_sym.kind == .map) && method_name in ['clone', 'keys', 'values', 'move', 'delete'] {