From b81f06e3699dbb1aca577876c13031394de22182 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 25 Apr 2022 16:53:29 +0300 Subject: [PATCH] checker: remove already handled "undefined" errors --- vlib/v/checker/check_types.v | 4 +++- vlib/v/checker/checker.v | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index ce15abbdf4..1d8f8929dd 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -204,7 +204,9 @@ pub fn (mut c Checker) check_expected_call_arg(got ast.Type, expected_ ast.Type, } return } - return error('cannot use `$got_typ_str` as `$expected_typ_str`') + if got != ast.void_type { + return error('cannot use `$got_typ_str` as `$expected_typ_str`') + } } // helper method to check if the type is of the same module. diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index e1fc0502c1..85dfa2a17a 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -1675,7 +1675,9 @@ pub fn (mut c Checker) selector_expr(mut node ast.SelectorExpr) ast.Type { c.inside_selector_expr = old_selector_expr c.using_new_err_struct = using_new_err_struct_save if typ == ast.void_type_idx { - c.error('`void` type has no fields', node.pos) + // This means that the field has an undefined type. + // This error was handled before. + // c.error('`void` type has no fields', node.pos) return ast.void_type } node.expr_type = typ