polserver/testsuite/escript/classes/fail-scopes-const-shadowing.src
Kevin Eady 0fa1b893a0 Update core-changes, break-changes for classes support (#719)
* Format testsuite escript

* Format testsuite pol

* Update docs
Switch "attributes" to "members" to better align with Escript terms.

* Add core-changes, breaking-changes
2024-10-10 18:06:04 +02:00

15 lines
469 B
Text

// A class-variable cannot shadow a constant, because the Optimizer will not
// be able to determine if an un-scoped identifier used in an expression
// references the constant or the class variable. The Optimizer runs _before_
// the Semantic Analyzer, so Identifier -> Variable information is not yet available.
//
const constant := 1;
class Animal()
var constant := 2;
var foo;
endclass
// Must reference the class to get the parse tree visited.
Animal::foo;