mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ast,checker: fix v test-self
by relaxing the is_number checks
This commit is contained in:
parent
ab77453f5f
commit
abbb08b28c
@ -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]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user