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

Confusing message when importing multiple unnamed libraries #20125

Closed
stevemessick opened this issue Jul 21, 2014 · 8 comments
Closed

Confusing message when importing multiple unnamed libraries #20125

stevemessick opened this issue Jul 21, 2014 · 8 comments
Assignees
Milestone

Comments

@stevemessick
Copy link
Contributor

[ed note: I can't find a repro that does not also generate errors, but I didn't try too hard.]

Hi, in the editor after the first local import statement i get the following warning for subsequent local imports:

"The imported libraries 'bendz_polymer_element.dart' and 'bendz_drag.dart' should not have the same name "

"The imported libraries 'bendz_polymer_element.dart' and 'bendz_var.dart' should not have the same name ''

This is on all files in the project where i import more than one dart file. Not affecting my project, but this has been ongoing for some time ... sry for only reporting it now.

Cheers
Pete (peter.schonefeld@gmail.com)
////////////////////////////////////////////////////////////////////////////////////
Editor: 1.5.3.release (2014-07-03)
OS: Windows 7 - amd64 (6.1)
JVM: 1.7.0_01

projects: 31

open dart files: 6

auto-run pub: true
localhost resolves to: 127.0.0.1
mem max/total/free: 1778 / 1226 / 471 MB
thread count: 22
index: 2800238 relationships in 335288 keys in 1397 sources

SDK installed: true
Dartium installed: true

@bwilkerson
Copy link
Member

Can you provide me with a small example? I can create a case in which the error message is valid, but cannot create a case in which the message should not have been produced.


Removed Priority-Unassigned label.
Added Priority-Medium, NeedsInfo labels.

@danrubel
Copy link

Perhaps the error message is not clear? Perhaps if there is no library declaration, it should say something like...

The imported libraries 'bendz_polymer_element.dart' and 'bendz_drag.dart' should not have the same name ''. One way to solve this problem is to add a library declaration to each library.

@DartBot
Copy link

DartBot commented Jul 30, 2014

This comment was originally written by peter.schone...@gmail.com


I think it may have something to do with how I've set up the project as can remember having issues with declaring a library so just opted for using local imports. Will have to revisit that.

I've included a screenshot of the warning and uploaded the code for a small troubleshooting project here: https://github.com/pschonefeld/dart-fun/tree/master/troubleshooting

Don't hesitate to let me know if you need more info.


Attachment:
dart_warning_bug.PNG (12.54 KB)

@bwilkerson
Copy link
Member

Sorry for the delay getting back to you. I looked at your example, and I believe that the warning, while perhaps confusing, is correct. If a library does not have a library directive that specifies the name of the library, then the name of the library is implicitly set to the empty string. This is the case for test_a.dart, test_b.dart, and test_c.dart. But it is a warning if two or more libraries are loaded that have the same library name.

Try adding "library test_a;" to test_a.dart, "library test_c;" to test_c.dart, and "library test_c;" to test_c.dart. That should make the warnings go away.


Added Analyzer-UX, Triaged labels.
Changed the title to: "Confusing message when importing multiple unnamed libraries".

@DartBot
Copy link

DartBot commented Aug 2, 2014

This comment was originally written by peter.schon...@gmail.com


Good to know! Thanks for your time on this.

@bwilkerson
Copy link
Member

Added Started label.

@bwilkerson
Copy link
Member

https://codereview.chromium.org/712663002/ (bleeding edge revision 41613)


Added Fixed label.

@clayberg
Copy link

Added this to the 1.8 milestone.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants