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

remove warnings/errors about duplicate library names #34665

Open
sigmundch opened this issue Oct 3, 2018 · 1 comment
Open

remove warnings/errors about duplicate library names #34665

sigmundch opened this issue Oct 3, 2018 · 1 comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language).

Comments

@sigmundch
Copy link
Member

I'm not sure if this is part of the spec or not, so I'm not sure if this is area-language or area-analyzer or something else. Please adjust as needed.

Library names are anyways not used for anything semantic and we encourage users to either drop them or use them only for documentation purposes. However, we complain about duplicate names when we find them, for example:

$ dartanalyzer a.dart
  error • The imported libraries 'b.dart' and 'c.dart' can't have the same name 'x' at a.dart:2:1 • import_duplicated_library_named
1 error found.

for a.dart:

import 'b.dart';
import 'c.dart';

main() {
  foo();
  bar();
}

b.dart

library x;
foo() {}

c.dart

library x;
bar() {}
@sigmundch sigmundch added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Oct 3, 2018
@Mabsten
Copy link

Mabsten commented Apr 9, 2021

This issue has been solved? I ask it because in Dart 2.12 the above example is no longer reported to me as erroneous, but also the related issue document that library directives should be unique is still open.

If duplicate library name are now allowed, I assume the specific library name is now totally irrelevant (dartdoc aside) to compile-time and runtime, i.e. it is only used in part-of directive with library name, which can be avoided by using part-of directives with library URI.

I ask this question because having to insert and mantain the library directives (necessary for the doc and the annotations at the library level) takes time, and I would like to understand how important the specific name is, in the hope of being able to do without it altogether when also #1073 Allow library declarations with no name is closed.

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).
Projects
None yet
Development

No branches or pull requests

2 participants