Skip to content

Compiler won't warn for certain impossible int bit array patterns #4959

@giacomocavalieri

Description

@giacomocavalieri

If I write a bit array pattern like this one:

case todo {
  <<-2:unsigned>> -> todo
  _ -> todo
}

The compiler should warn that that branch is unreachable since it's impossible that an unsigned number matches with the value -2. This happens in all cases where we're matching on a number that can't be represented with the given size and signedness.

This not being handled properly also leads to some code generation bugs on the javascript target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions