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

duplicate 'part' statements should be flagged as errors explicitly #12735

Closed
kevmoo opened this issue Aug 26, 2013 · 11 comments
Closed

duplicate 'part' statements should be flagged as errors explicitly #12735

kevmoo opened this issue Aug 26, 2013 · 11 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@kevmoo
Copy link
Member

kevmoo commented Aug 26, 2013

At the moment, I'm getting "class Foo is already defined" in the duplicate part file.

Ideally, this warning would be in the library definition.

@bwilkerson
Copy link
Member

Added this to the M7 milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@iposva-google
Copy link
Contributor

Added Triaged label.

@bwilkerson
Copy link
Member

Do we want to have a warning for this situation? As far as I can see there's nothing in the specification that disallows it, and as long as the part is empty there won't be any errors or warnings. If not, analyzer can provide a hint.


Set owner to @gbracha.

@kevmoo
Copy link
Member Author

kevmoo commented Sep 12, 2013

It's reasonable that importing the same file twice would be a warning...at a minimum.

The big problem here: if someone inadvertently imports the same file twice, it's not obvious why the "already defined" error is being reported. A tough user experience.

@jwren
Copy link
Member

jwren commented Sep 19, 2013

M7 -> M8


Removed this from the M7 milestone.
Added this to the M8 milestone.

@bwilkerson
Copy link
Member

Removed Area-Analyzer label.
Added Area-Language label.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M8 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@gbracha
Copy link
Contributor

gbracha commented Aug 27, 2014

Better error messages would resolve the user experience issue. For example, stating what part directive, at what line, caused the duplicate declaration. I'm not convinced that we need more language rules rather than better tooling.


Added Accepted label.

@kevmoo kevmoo added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). labels Aug 27, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed accepted labels Feb 29, 2016
@srawlins
Copy link
Member

This is now a static error raised by the analyzer:

$ cat 23674.dart 
library my_library;

part '23674-part.dart';
part '23674-part.dart'; // No warning
$ cat 23674-part.dart 
part of my_library;

class ClassInMyPart {}
$ dartanalyzer --version
dartanalyzer version 2.0.0-dev.63.0
$ dartanalyzer 23674.dart 
Analyzing 23674.dart...
  error • The library already contains a part with the uri 'file:///Users/srawlins/code/23674-part.dart' at 23674.dart:4:6 • duplicate_part
1 error found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants