hash-org / hash-org/hashc

tc: confussion between `usize` and `u64`

Open
#991 1 comment 0 reactions 0 assignees View on GitHub
bug type-system
Dominant language
Rust
Stars
28
Forks
1
PR merge metrics
No merged PRs in 30d

Description

The following snippet:

```rust
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:

```rust
--> /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 `u64`s

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.