Files
sdk/tests/language/primary_constructors/scope
Kallen Tu 1f534ed52d [tests] Primary constructors - var tests, update final tests, primary initializer scope.
Tests for the following:
- Declaration cycles.
- A compile-time error occurs if an assignment to a primary parameter
occurs in the initializing expression of a non-late instance variable.
- A compile-time error occurs if an assignment to a primary parameter
occurs in the initializer list of the body part of a primary
constructor.
- Late variables cannot access primary constructor parameters.
- Declarations without primary constructors don't have a primary
initializer scope.
- The primary initializer scope is the current scope for the
initializing expression, if any, of each non-late instance variable
declaration. It is also the current scope for the initializer list in the body part of the primary constructor, if any.
- The primary parameter scope is the current scope for the body of the
body part of the primary constructor, if any. Every primary parameter
which is not declaring, not initializing, and not a super parameter is
introduced into this scope.
- It's a compile-time error to write a formal non-declaring parameter with a `var` keyword and no type annotation.

Bug: https://github.com/dart-lang/sdk/issues/61687
Change-Id: If4dde05ac61fb69ef06a85df3bc36a47b1df57b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479420
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2026-02-11 15:20:52 -08:00
..