Merge pull request #8366 from krux02/nimnode-or

or on NimNode
This commit is contained in:
Arne Döring 2018-10-18 17:49:47 +02:00 • committed by GitHub
commit 9f18a4f448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 1 deletions

View file

@ -79,3 +79,17 @@ static:
assert fooSym.kind in {nnkOpenSymChoice, nnkClosedSymChoice}
assert fooSym.eqIdent("fOO")
assertNot fooSym.eqIdent("bar")
var empty: NimNode
var myLit = newLit("str")
assert( (empty or myLit) == myLit )
empty = newEmptyNode()
assert( (empty or myLit) == myLit )
proc bottom(): NimNode =
quit("may not be evaluated")
assert( (myLit or bottom()) == myLit )