hashc icon indicating copy to clipboard operation
hashc copied to clipboard

tc: confussion between `usize` and `u64`

Open feds01 opened this issue 1 year ago • 1 comments

The following snippet:

main := () => {
    buf := [1u8; 4usize + 5usize]](buf: [u8; { 1usize + 1usize }] = [1u8, 1u8])
}

Should produce this behaviour:

The snippet should type check and produce no errors, instead, the typechecking reports an error that there is a mismatched between the types, where it wanted a usize but got a u64 instead:

 --> /Users/alex/projects/hash-org/hashc/examples/main.hash:2:17
1 |   main := () => {
2 |       buf: [u8; { 1usize + 1usize }] = [1u8, 1u8]
  |                   ^^^^^^ this is of type `u64`
3 |   }

There are probably other similar bugs where there is some confusion between usize literals and them being treated as u64s

feds01 avatar Sep 23 '23 16:09 feds01