added tests

This commit is contained in:
Moritz Gmeiner 2024-09-01 19:15:55 +02:00
commit 660464638f
255 changed files with 7220 additions and 3 deletions

View file

@ -0,0 +1,28 @@
// This is a regression test. When closing upvalues for discarded locals, it
// wouldn't make sure it discarded the upvalue for the correct stack slot.
//
// Here we create two locals that can be closed over, but only the first one
// actually is. When "b" goes out of scope, we need to make sure we don't
// prematurely close "a".
var closure;
{
var a = "a";
{
var b = "b";
fun returnA() {
return a;
}
closure = returnA;
if (false) {
fun returnB() {
return b;
}
}
}
print closure(); // expect: a
}