diff options
author | metagn <metagngn@gmail.com> | 2024-09-30 18:34:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 17:34:49 +0200 |
commit | 2a48182288b1c6fbc01070e5e1ffb7653b3599e3 (patch) | |
tree | abc22306201b420fb5550830231e0bdf2a39a38c /lib | |
parent | febc58e0365f683df0eee973e7fa183d8cfaddbc (diff) | |
download | Nim-2a48182288b1c6fbc01070e5e1ffb7653b3599e3.tar.gz |
remove `prev == nil` requirement for typedesc params as type nodes (#24206)
fixes #24203 `semTypeNode` is called twice for RHS'es of type sections, [here](https://github.com/nim-lang/Nim/blob/b0e6d28782ce8c3d8e0b4a64e01f21d6f900648f/compiler/semstmts.nim#L1612) and [here](https://github.com/nim-lang/Nim/blob/b0e6d28782ce8c3d8e0b4a64e01f21d6f900648f/compiler/semstmts.nim#L1646). Each time `prev` is `s.typ`, but the assertion expects `prev == nil` which is false since `s.typ` is not nil the second time. To fix this, the `prev == nil` part of the assertion is removed. The reason this only happens for types like `seq[int]`, `(int, int)` etc is because they don't have syms: `semTypeIdent` attempts to directly [replace the typedesc param itself](https://github.com/nim-lang/Nim/blob/b0e6d28782ce8c3d8e0b4a64e01f21d6f900648f/compiler/semtypes.nim#L1916) with the sym of the base type of the resolved typedesc type if it exists, which means `semTypeNode` doesn't receive the typedesc param sym to perform the assert.
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions