Skip to content

Dartc is too smart when dealing with variable declarations #3223

Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


The spes in the section 11.3 says: "A variable declaration statement var id; or var id = e; introduces a new variable named id with static type Dynamic into the innermost enclosing scope.".
This means there should not be any static warnings in this test:

func(int p) {}

main() {
  var param = true;
  func(param);
}

But Dartc, r7976, produces a static warning: "bool is not assignable to int".

Changing code to

func(int p) {}

main() {
  var param;
  param = true;
  func(param);
}

solves this problem.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions