Skip to content

Declaring variable with same name as existing variable should be an error #572

@DartBot

Description

@DartBot

This issue was originally filed by domi...@google.com


1 void OverrideParameter(int s) {
2 String s = '42';
3 write(s);
4
5 double s = 42.0;
6 }

There should be errors at lines 2 and 5 where variables are being declared with the same names as existing variables in scope.

This can lead to very subtle bugs and although they might be caught when the variables are used, it would be better to flag the error early.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions