diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 43826c4ff4..ecd9d0b281 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -140,12 +140,12 @@ pub fn (mut c Checker) check_basic(got ast.Type, expected ast.Type) bool { return true } // allow `return 0` in a function with `?int` return type - expected_nonopt := expected.clear_flag(.optional) - if got == ast.int_literal_type && expected_nonopt.is_int() { + expected_nonflagged := expected.clear_flags() + if got == ast.int_literal_type && expected_nonflagged.is_int() { return true } // allow `return 0` in a function with `?f32` return type - if got == ast.float_literal_type && expected_nonopt.is_float() { + if got == ast.float_literal_type && expected_nonflagged.is_float() { return true } return false