Open anton-trunov opened 2 months ago
Shadowing is not allowed. And with recent fix of variable scoping bug in loops, the scope of a variable declared with let
is one of the following curly-brace-enclosed syntaxes that most closely contains the let
statement:
try...catch
, if...else
, all loops, etc.The scope of the persistent state variable is all the receiver, getter and internal function bodies of the contract/trait.
We need var-scope tests in the compiler to make sure the docs say the truth: https://github.com/tact-lang/tact/issues/288
Intrestingly enough, function shadowing is not allowed, but has inconsistent behavior:
ton()
it works just fine, but when trying to call it the actual global.ts ton()
is being called instead of the freshly defined one. Notice, that there's no error if the arguments are exactly what the global.ts function expected, which can lead to unexpected results!beginCell()
— that very attempt is marked as an error Static function beginCell() already exists
.Shadowing is not allowed
We should definitely have test cases for all the cases listed below in https://github.com/tact-lang/tact-docs/issues/191#issuecomment-2073163857
For instance, is variable shadowing allowed?