From 7a9607b0286e6cb327e33389bc6bfcc09334069d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 5 Apr 2021 10:39:48 +0300 Subject: [PATCH] checker: use .clear_flags() when comparing number literals --- vlib/v/checker/check_types.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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