summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-09-09 17:22:37 +0800
committerGitHub <noreply@github.com>2024-09-09 11:22:37 +0200
commit9ff0333a4ccffb253f03fc113d086bbc81b566e9 (patch)
tree66e623d58cadf6669fc236d8abad7f4dd4b75b05 /tests
parent24e5b21c900811ae8d0a69e06fc35fdd884b3ddc (diff)
downloadNim-9ff0333a4ccffb253f03fc113d086bbc81b566e9.tar.gz
fixes #21353; fixes default closure in the VM (#24070)
fixes #21353

```nim
  result = newNodeIT(nkTupleConstr, info, t)
  result.add(newNodeIT(nkNilLit, info, t))
  result.add(newNodeIT(nkNilLit, info, t))
```
The old implementation uses `t` which is the type of the closure
function as its type. It is not correct and generates ((nil, nil), (nil,
nil)) for `default(closures)`. This PR creates `(tyPointer, tyPointer)`
for fake closure types just like what cctypes do.
Diffstat (limited to 'tests')
-rw-r--r--tests/vm/tvmmisc.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim
index 6160702ad..6aeac5529 100644
--- a/tests/vm/tvmmisc.nim
+++ b/tests/vm/tvmmisc.nim
@@ -790,3 +790,7 @@ block: # bug #23925
 
   static: bar()
   bar()
+
+static: # bug #21353
+  var s: proc () = default(proc ())
+  doAssert s == nil