From fec19c980e36e62747eb119f0740cb785e858ac3 Mon Sep 17 00:00:00 2001 From: flywind <43030857+xflywind@users.noreply.github.com> Date: Tue, 17 Nov 2020 18:47:01 +0800 Subject: follow #16009 VM supports cast nil to ptr (#16012) * follow #16009 VM supports cast nil to ptr * more testcase --- tests/vm/tcastnil.nim | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/vm/tcastnil.nim (limited to 'tests') diff --git a/tests/vm/tcastnil.nim b/tests/vm/tcastnil.nim new file mode 100644 index 000000000..5a4684f95 --- /dev/null +++ b/tests/vm/tcastnil.nim @@ -0,0 +1,30 @@ +discard """ + nimout: '''nil +nil +nil +nil +nil +''' +""" + +block: + static: + let a = cast[pointer](nil) + echo a.repr + +block: + static: + echo cast[ptr int](nil).repr + +block: + const str = cast[ptr int](nil) + static: + echo str.repr + +block: + static: + echo cast[ptr int](nil).repr + +block: + static: + echo cast[RootRef](nil).repr -- cgit 1.4.1-2-gfad0