fix: missing unboxing in interpreter when loading initialized value (#4512)

Fixes #4457
This commit is contained in:
Sebastian Ullrich 2024-06-20 12:06:24 +02:00 committed by GitHub
parent 7d7f378e02
commit 1f732bb3b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 1 deletions

View file

@ -796,7 +796,7 @@ private:
}
if (object * const * o = g_init_globals->find(fn)) {
// persistent, so no `inc` needed
return *o;
return type_is_scalar(t) ? unbox_t(*o, t) : *o;
}
symbol_cache_entry e = lookup_symbol(fn);

1
tests/pkg/initialize/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.lake

View file

@ -0,0 +1,5 @@
import Initialize.Basic
/-- info: 42 -/
#guard_msgs in
#eval initNat

View file

@ -0,0 +1 @@
initialize initNat : Nat ← pure 42

View file

@ -0,0 +1,5 @@
name = "initialize"
defaultTargets = ["Initialize"]
[[lean_lib]]
name = "Initialize"

4
tests/pkg/initialize/test.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
rm -rf .lake/build
lake build