diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index f82d467d9c..e97fdde1e1 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -278,12 +278,12 @@ pub fn (typ Type) is_pointer() bool { [inline] pub fn (typ Type) is_float() bool { - return typ.idx() in ast.float_type_idxs + return typ.clear_flags() in ast.float_type_idxs } [inline] pub fn (typ Type) is_int() bool { - return int(typ) in ast.integer_type_idxs + return typ.clear_flags() in ast.integer_type_idxs } [inline] @@ -303,7 +303,13 @@ pub fn (typ Type) is_int_literal() bool { [inline] pub fn (typ Type) is_number() bool { - return int(typ) in ast.number_type_idxs + return typ.clear_flags() in ast.number_type_idxs +} + +pub fn (typ Type) is_number_or_literal() bool { + res := int(typ) in ast.number_type_idxs + eprintln('> is_number_or_literal typ: $typ.debug() | res: $res') + return res } [inline] diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 7ee1dd4e7a..4223fbdf24 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -203,7 +203,7 @@ fn (mut c Checker) check_shift(left_type ast.Type, right_type ast.Type, left_pos return left_type } -pub fn (c &Checker) promote(left_type ast.Type, right_type ast.Type) ast.Type { +pub fn (mut c Checker) promote(left_type ast.Type, right_type ast.Type) ast.Type { if left_type.is_ptr() || left_type.is_pointer() { if right_type.is_int() { return left_type