Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Introduce an explicit overload of the `<` and `<=` system operators for `cstring`, removing the reliance on `cstring` being implicitly convertible to `pointer`. ## Details `cstring` is currently always implicitly convertible to `pointer`, which meant that the `LePtr` and `LtPtr` magic overloads were chosen so far (through introduction of an implicit conversion for the arguments). This is a problem for the upcoming MIR rework, as there the result of each operation has to be assignable to a temporary. Since `jsgen` treats the `cstring`-to-`pointer` conversion as a no-op, the assignment would result in a typing error within the JS code generator. As a preparation for both the MIR rework and for revisiting the semantics of cstrings, explicit `<` and `<=` overloads are introduced for `cstring`. Using imported overloads when the JS backend is enabled wouldn't work, as that'd prevent the comparison operators from being used in compile-time(-only) contexts. The introduction is backwards compatible with the csources compiler, so no new conditional symbol is required. For `tset_with_range.nim` the number of mismatching overloads in the error message is updated.
- Loading branch information