Files
Odin/tests
Matthew Winter 4dad4ef64c Give switch range bounds the type of the switch tag
The bounds of a `switch` range case were checked against the tag but
never converted to its type, unlike a single case value, so untyped
bounds took their own default type. Against a `cstring` tag `"0"..="9"`
became `string` bounds, and converting a constant `string` to `cstring`
in the backend crashed the compiler. A `cstring16` or `string16` tag
failed with an invalid conversion from `string` instead. Convert the
bounds to the tag's type, which also gives an invalid bound the same
error as a single case value.

A constant `cstring` or `cstring16` tag forced the `string` comparison
procedures rather than its own, so it failed with a missing
`cstring_le` or `cstring16_le` even with typed bounds.

`lb_get_const_string` expected the data pointer of a constant string to
be a zero index GEP, which LLVM folds to the global itself, and it is
null for an empty string, so it read an invalid constant expression.
Handle both, and have a converted empty string point to its terminator
like a constant `cstring` rather than be nil.

Fixes #7853
2026-10-12 01:31:42 +11:00
..
…
…