mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-27 01:34:02 +00:00
fix getNullValue for cstring in VM, make other VM code aware of nil cstring (#22527)
* fix getNullValue for cstring in VM
fixes #22524
* very ugly fixes, but fix #15730
* nil cstring len works, more test lines
* fix high
(cherry picked from commit 942f846f04)
This commit is contained in:
@@ -733,3 +733,34 @@ block: # bug #22190
|
||||
tab = mkOpTable(Berlin)
|
||||
|
||||
doAssert not tab
|
||||
|
||||
block: # issue #22524
|
||||
const cnst = cstring(nil)
|
||||
doAssert cnst.isNil
|
||||
doAssert cnst == nil
|
||||
let b = cnst
|
||||
doAssert b.isNil
|
||||
doAssert b == nil
|
||||
|
||||
let a = static: cstring(nil)
|
||||
doAssert a.isNil
|
||||
|
||||
static:
|
||||
var x: cstring
|
||||
doAssert x.isNil
|
||||
doAssert x == nil
|
||||
doAssert x != ""
|
||||
|
||||
block: # issue #15730
|
||||
const s: cstring = ""
|
||||
doAssert s != nil
|
||||
|
||||
static:
|
||||
let s: cstring = ""
|
||||
doAssert not s.isNil
|
||||
doAssert s != nil
|
||||
doAssert s == ""
|
||||
|
||||
static: # more nil cstring issues
|
||||
let x = cstring(nil)
|
||||
doAssert x.len == 0
|
||||
|
||||
Reference in New Issue
Block a user