allow deferred close of nil stream (#20706)

* allow deferred close of nil stream

* improve example
This commit is contained in:
n5m 2022-10-31 10:20:06 +00:00 • committed by GitHub
commit 52166e3546
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View file

@ -50,6 +50,12 @@ block tstreams3:
echo line
s.close
block:
let fs = newFileStream("amissingfile.txt")
defer: fs.close()
doAssert isNil(fs)
# bug #12410
var a = newStringStream "hehohihahuhyh"