ast,checker: fix `v test-self` by relaxing the is_number checks
parent
ab77453f5f
commit
abbb08b28c
|
@ -278,12 +278,12 @@ pub fn (typ Type) is_pointer() bool {
|
||||||
|
|
||||||
[inline]
|
[inline]
|
||||||
pub fn (typ Type) is_float() bool {
|
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]
|
[inline]
|
||||||
pub fn (typ Type) is_int() bool {
|
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]
|
[inline]
|
||||||
|
@ -303,7 +303,13 @@ pub fn (typ Type) is_int_literal() bool {
|
||||||
|
|
||||||
[inline]
|
[inline]
|
||||||
pub fn (typ Type) is_number() bool {
|
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]
|
[inline]
|
||||||
|
|
|
@ -203,7 +203,7 @@ fn (mut c Checker) check_shift(left_type ast.Type, right_type ast.Type, left_pos
|
||||||
return left_type
|
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 left_type.is_ptr() || left_type.is_pointer() {
|
||||||
if right_type.is_int() {
|
if right_type.is_int() {
|
||||||
return left_type
|
return left_type
|
||||||
|
|
Loading…
Reference in New Issue