Files
Nim/tests/template/tgenericobjconstr.nim
metagn 6d59680217 don't try to transform objconstr/cast type nodes (#24636)
fixes #24631

[Object
constructors](793baf34ff/compiler/semobjconstr.nim (L462)),
[casts](793baf34ff/compiler/semexprs.nim (L494))
and [type
conversions](793baf34ff/compiler/semexprs.nim (L419))
copy their type nodes verbatim instead of producing semchecked type
nodes. This causes a crash in transf when an untyped expression in the
type node has `nil` type. To deal with this, don't try to transform the
type node in these expressions at all. I couldn't reproduce the problem
with type conversion nodes though so those are unchanged in transf.
2025-01-22 14:08:21 +01:00

16 lines
228 B
Nim

discard """
matrix: "--skipParentCfg"
"""
# issue #24631
type
V[d: static bool] = object
l: int
template y(): V[false] = V[false](l: 0)
discard y()
template z(): V[false] = cast[V[false]](V[false](l: 0))
discard z()