diff options
author | metagn <metagngn@gmail.com> | 2024-09-03 10:18:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 09:18:38 +0200 |
commit | 538603e01d9b0c4abd47799bbe031960ffea3610 (patch) | |
tree | c0c83bfba3ac20c45b5badff6ebf0ddaaaf4ba2a /compiler/ccgstmts.nim | |
parent | 1ebdcb3bcaac3259193de6f8ce1d94889c3dc100 (diff) | |
download | Nim-538603e01d9b0c4abd47799bbe031960ffea3610.tar.gz |
allow conversions between `var` types of range types and base types (#24037)
refs #24032, split from #24036 Conversion from variables of range types or base types of range types to the other are now considered mutable for `var` params, similar to how distinct types are mutable when converted to their base type or vice versa. There are 2 main differences: 1. Conversions from base types to range types need to emit `nkChckRange`, which is not generated for things like tuple/object fields. 2. Range types can still correspond to different types in the backend when nested in other types, such as `set[range[3..5]]` vs `set[range[0..5]]`. Since the convertibility check for `var` params and a check whether to emit a no-op for `nkConv` (and now also `nkChckRange`) so that the output is still addressable both use `sameType`, we accomplish this by adding a new flag to `sameType` that ignores range types, but only when they're not nested in other types. The implementation for this might be flawed, I didn't include children of some metatypes as "nested in other types", but stuff like `tyGenericInst` params are respected.
Diffstat (limited to 'compiler/ccgstmts.nim')
0 files changed, 0 insertions, 0 deletions