Make range checks in semConv (#7164)
* Remove NaN/Inf/NegInf magic * Make range checks in semConv * fix the failing line * fix `firstOrd` and `lastOrd` * fix `localError` * remove debug comment * Cleanup, fix failing test * make tests green
This commit is contained in:
parent
3a479ff53f
commit
de5c0d3aa9
9 changed files with 103 additions and 26 deletions
|
|
@ -559,9 +559,6 @@ proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode =
|
|||
of mBuildOS: result = newStrNodeT(toLowerAscii(platform.OS[g.config.target.hostOS].name), n, g)
|
||||
of mBuildCPU: result = newStrNodeT(platform.CPU[g.config.target.hostCPU].name.toLowerAscii, n, g)
|
||||
of mAppType: result = getAppType(n, g)
|
||||
of mNaN: result = newFloatNodeT(NaN, n, g)
|
||||
of mInf: result = newFloatNodeT(Inf, n, g)
|
||||
of mNegInf: result = newFloatNodeT(NegInf, n, g)
|
||||
of mIntDefine:
|
||||
if isDefined(g.config, s.name.s):
|
||||
try:
|
||||
|
|
@ -733,7 +730,7 @@ proc getConstExpr(m: PSym, n: PNode; g: ModuleGraph): PNode =
|
|||
var a = getConstExpr(m, n.sons[1], g)
|
||||
if a == nil: return
|
||||
# XXX: we should enable `check` for other conversion types too
|
||||
result = foldConv(n, a, g, check=n.kind == nkHiddenSubConv)
|
||||
result = foldConv(n, a, g, check=n.kind == nkHiddenStdConv)
|
||||
of nkCast:
|
||||
var a = getConstExpr(m, n.sons[1], g)
|
||||
if a == nil: return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue