Semfold for nil cast (#16030)
* bring back the semfold of nil * remove space * fix test * proc type can't be dereferenced
This commit is contained in:
parent
33d79b9e64
commit
87d3e5331a
3 changed files with 8 additions and 5 deletions
|
|
@ -674,7 +674,7 @@ proc getConstExpr(m: PSym, n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode
|
|||
of nkCast:
|
||||
var a = getConstExpr(m, n[1], idgen, g)
|
||||
if a == nil: return
|
||||
if n.typ != nil and n.typ.kind in NilableTypes and a.kind != nkNilLit:
|
||||
if n.typ != nil and n.typ.kind in NilableTypes:
|
||||
# we allow compile-time 'cast' for pointer types:
|
||||
result = a
|
||||
result.typ = n.typ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue