Skip to content

Using a variable in a scope before its declared that shadows another variable #2382

Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


dartc fails Language/03_Overview/1_Scoping_A02_t10.dart

/*

  • @­description Checks that both compile-time error and a static warning are produced if
     * a variable is used in a block before it's shadowing declaration.
     * @­static-warning
     * @­compile-error
     */

main() {
  var x;
  {
    x = 1;
    var x = 2;
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions