fuzion
fuzion copied to clipboard
Some numerical conversion don't check if the value fits into the target type
This produces an error as expected
a i32 := 1234578
b i8 := a.as_i8
say "$a.as_i8 is $b"
but this doesn't
a i32 := 1234578
b u8 := a.as_u8
say "$a.as_u8 is $b" # should produce an error but doesn't
for as_u8 this is caused by #3051
but there are still some preconditions missing, e.g.
a i64 := 70000
b u16 := a.as_u16
say "$a.as_u16 is $b"
produces the output 70000.as_u16 is 4464
this does not yet work
❯ fz -e 'a i32 := 1234578; b u8 := a.as_u8; say "$a.as_u8 is $b but should produce an error"'
1234578.as_u8 is 146 but should produce an error
@simonvonhackewitz #3051 is fixed now. Please take a look at this issue again.
solved in #4732