[fine] Bindings in if remain in scope!

This commit is contained in:
John Doty 2024-02-03 09:54:46 -08:00
parent 198dc5bdb3
commit f00b9e22e7
2 changed files with 34 additions and 3 deletions

View file

@ -3,17 +3,20 @@ class Foo {
}
fun test() -> f64 {
let b = new Foo { a : 23 };
let b = new Foo { a : 1000 };
let result = 0;
if b is c:Foo and c.a == 23 {
if b is c:Foo and c.a == 1000 {
result = result + 1;
}
if b is c:Foo and c.a == 24 {
result = result + 10;
}
if b is c:Foo {
result = result + c.a; // c should still be in scope!
}
result
}
// @no-errors
// @eval: Float(1.0)
// @eval: Float(1001.0)