forked from AbleOS/holey-bytes
fixing upcasting signed to unsigned
This commit is contained in:
parent
e62aab9b4b
commit
b1da36ecde
|
@ -842,6 +842,11 @@ integer_range := fn(min: uint, max: uint): uint {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### signed_to_unsigned_upcast
|
||||||
|
```hb
|
||||||
|
main := fn(): uint return @as(i32, 1)
|
||||||
|
```
|
||||||
|
|
||||||
#### writing_into_string
|
#### writing_into_string
|
||||||
```hb
|
```hb
|
||||||
outl := fn(): void {
|
outl := fn(): void {
|
||||||
|
|
|
@ -434,6 +434,7 @@ mod ty {
|
||||||
_ if oa.is_pointer() && ob.is_pointer() => return None,
|
_ if oa.is_pointer() && ob.is_pointer() => return None,
|
||||||
_ if a.is_signed() && b.is_signed() || a.is_unsigned() && b.is_unsigned() => ob,
|
_ if a.is_signed() && b.is_signed() || a.is_unsigned() && b.is_unsigned() => ob,
|
||||||
_ if a.is_unsigned() && b.is_signed() && a.repr() - U8 < b.repr() - I8 => ob,
|
_ if a.is_unsigned() && b.is_signed() && a.repr() - U8 < b.repr() - I8 => ob,
|
||||||
|
_ if a.is_unsigned() && b.is_signed() && a.repr() - U8 > b.repr() - I8 => oa,
|
||||||
_ if oa.is_integer() && ob.is_pointer() && kind == TyCheck::BinOp => ob,
|
_ if oa.is_integer() && ob.is_pointer() && kind == TyCheck::BinOp => ob,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
})
|
})
|
||||||
|
|
|
@ -4435,6 +4435,7 @@ mod tests {
|
||||||
small_struct_assignment;
|
small_struct_assignment;
|
||||||
intcast_store;
|
intcast_store;
|
||||||
string_flip;
|
string_flip;
|
||||||
|
signed_to_unsigned_upcast;
|
||||||
wide_ret;
|
wide_ret;
|
||||||
comptime_min_reg_leak;
|
comptime_min_reg_leak;
|
||||||
different_types;
|
different_types;
|
||||||
|
|
0
lang/tests/son_tests_signed_to_unsigned_upcast.txt
Normal file
0
lang/tests/son_tests_signed_to_unsigned_upcast.txt
Normal file
Loading…
Reference in a new issue