Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple diagnostic messages emitted for duplicate definition #26788

Open
eernstg opened this issue Jun 29, 2016 · 1 comment
Open

Multiple diagnostic messages emitted for duplicate definition #26788

eernstg opened this issue Jun 29, 2016 · 1 comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dart2js

Comments

@eernstg
Copy link
Member

eernstg commented Jun 29, 2016

With reference to the common issue #18361, and following the recommendation in tests/compiler/dart2js/message_kind_helper.dart to create an issue on this situation:

Duplicate declarations of initializing formal parameters give rise to multiple diagnostic messages with dart2js --initializing-formal-access. For instance, consider the following program:

class C {
  var x;
  C(this.x, this.x);
}

main() {
  print(new C(2, 2));
}

The program causes the following messages:

Error: Field 'x' is initialized more than once.
Info: 'x' was already initialized here.
008.dart:6:18:
Error: Duplicate definition of 'x'.
Try to rename or remove this definition.
  C(this.x, this.x);
                 ^
008.dart:6:10:
Info: Existing definition of 'x'.
  C(this.x, this.x);
         ^
Error: Compilation failed.

Emitting messages about just one of the problems caused by the duplication would be less confusing for developers. No information would be lost since there is only one root problem: the duplication.

Note that the effect of having option --initializing-formal-access will be the regular semantics soon, i.e., the issue will then exist also for runs with no options.

@eernstg
Copy link
Member Author

eernstg commented Nov 30, 2016

Turns out the problem still exists.

@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants