[fine] a note about a latent bug

This commit is contained in:
John Doty 2024-01-09 09:22:48 -08:00
parent f8f5c9bfac
commit 5c05077312

View file

@ -401,6 +401,22 @@ impl<'a> Semantics<'a> {
TreeKind::LetStatement => self.environment_of_let(parent, tree),
TreeKind::FunctionDecl => self.environment_of_func(parent, tree),
// TODO: Blocks should introduce a local environment if required.
// Test with a type error in a block statement and a
// binding outside. You will need a new assertion type and
// possibly a compile/run to ensure it works.
//
// let x = 7;
// {
// let x = 23;
// }
// print(x); // 7
//
// {
// let y = 12; // check: `y` is local not global!
// }
// print(y); // error, cannot find 'y'
// TODO: MORE Things that introduce an environment!
_ => parent,
};