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

Analyzer CLI no longer detects duplicate parts #26692

Open
whesse opened this issue Jun 13, 2016 · 11 comments
Open

Analyzer CLI no longer detects duplicate parts #26692

whesse opened this issue Jun 13, 2016 · 11 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone

Comments

@whesse
Copy link
Contributor

whesse commented Jun 13, 2016

The co19 test Language/Libraries_and_Scripts/Parts/compilation_t02 now fails on the analyzer, because the command-line analyzer no longer detects that the same part is included twice after cache dependencies are no longer checked, a change introduced in
https://codereview.chromium.org/2058253002

Is this intended?

@scheglov @bwilkerson

@whesse whesse added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-command Issues with the command-line dartanalyzer tool bug labels Jun 13, 2016
@whesse
Copy link
Contributor Author

whesse commented Jun 13, 2016

The test Language/Libraries_and_Scripts/Parts/compilation_t01 also fails. It no longer detects that the same function is declared in both the part and the main file.

whesse added a commit that referenced this issue Jun 13, 2016
BUG=#26692
R=sgjesse@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2062803002 .
@bwilkerson bwilkerson added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Jun 13, 2016
@bwilkerson
Copy link
Member

No, it isn't intended.

@scheglov
Copy link
Contributor

That's strange.
I'm pretty sure I ran all the tests before committing the change.

And these tests pass even now, after I rollback the status suppression.

scheglov@scheglov-macbookpro3:~/Source/Dart/sdk.git/sdk ((093672f...))$ d-rat
Please set JAVA_HOME to /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
xcodebuild -project dart.xcodeproj -target packages -configuration ReleaseIA32 SYMROOT=/Users/scheglov/Source/Dart/sdk.git/sdk/xcodebuild
Build settings from command line:
    SYMROOT = /Users/scheglov/Source/Dart/sdk.git/sdk/xcodebuild

** BUILD SUCCEEDED **

Test configuration: dart2analyzer_none_release_ia32
Total: 17649 tests
 * 122 tests will be skipped (18 skipped by design)
 * 35 tests are expected to be flaky but not crash
 * 0 tests are expected to flaky crash
 * 16427 tests are expected to pass
 * 29 tests are expected to fail that we won't fix
 * 1022 tests are expected to fail that we should fix
 * 2 tests are expected to crash that we should fix
 * 0 tests are allowed to timeout
 * 0 tests are skipped on browsers due to compile-time error
 * 12 could not be categorized or are in multiple categories

[02:07 | 100% | +17527 | -    0]

They also work in manual testing:

scheglov@scheglov-macbookpro3:~/Source/Dart/sdk.git/sdk/tests/co19/src ((3f0a4bc...))$
scheglov@scheglov-macbookpro3:~/Source/Dart/sdk.git/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts ((3f0a4bc...))$ d-ra compilation_t01.dart
Analyzing [compilation_t01.dart]...
[error] The name 'foo' is already defined (/Users/scheglov/Source/Dart/sdk.git/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts/part_0.dart, line 12, col 7)
1 error found.

scheglov@scheglov-macbookpro3:~/Source/Dart/sdk.git/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts ((3f0a4bc...))$ d-ra compilation_t02.dart
Analyzing [compilation_t02.dart]...
[error] The name 'Annot' is already defined (/Users/scheglov/Source/Dart/sdk.git/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts/part_0.dart, line 8, col 7)
[error] The name 'foo' is already defined (/Users/scheglov/Source/Dart/sdk.git/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts/part_0.dart, line 12, col 7)
[error] The name 'bar' is already defined (/Users/scheglov/Source/Dart/sdk.git/sdk/tests/co19/src/Language/Libraries_and_Scripts/Parts/part_0.dart, line 13, col 5)
3 errors found.

@whesse
Copy link
Contributor Author

whesse commented Jun 13, 2016

Yes, these are being flakey on the buildbot. So there may be some race condition, or timing, that affects this. I'll think about ways to reproduce this. This is on linux, btw, so maybe it doesn't happen on mac.

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) bug labels Jun 15, 2016
@scheglov
Copy link
Contributor

As I can see, the specification does not disallow referring to the same part twice. We started discussing this, but there was no resolution, and the specification has not been changes yet.

It seems like a right thing to do.
Who is in charge of the specification these days? @kevmoo @munificent @lrhn ?

@scheglov scheglov added the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Sep 23, 2016
@bwilkerson
Copy link
Member

The language team is in charge of the specification, and they are already considering changing parts to use URI's rather than names, which will resolve this issue.

@scheglov
Copy link
Contributor

Will it? This issue is not about part of, it's about part "my_part.dart" twice in the same library.

@bwilkerson
Copy link
Member

Oh, sorry, I didn't read carefully enough. No, this is unrelated. I'll send an e-mail to the language team.

@lrhn
Copy link
Member

lrhn commented Sep 24, 2016

There are basically three solutions:

  • Disallow it.
  • Allow it and let every part declaration become malformed due to duplicate declaration.
  • Allow it and if a part if included twice, it's only used once anyway.

The third is what we do for libraries - if you import the same library twice, it works because both imported names refer to the same declaration. I think we can do something similar for part inclusions.
Like for libraries, it means that you must always fetch each URI at most once. If a library has the same part twice and it fetches it twice from a server that sends different files, then everything is a mess.

The second is what the current specification give us. If you include the contents of the part file twice, it means that its declarations are declared twice in the same scope. Well, maybe, it's not precisely specified what

The top-level declarations at that URI are then compiled by the Dart compiler in the scope of
the current library

really means, but it would not be an incorrect interpretation.

Then again, no real program would be affected by just disallowing it, so that might just be easier.

@bwilkerson
Copy link
Member

I would be in favor of disallowing it.

@bwilkerson bwilkerson added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Nov 29, 2016
@bwilkerson bwilkerson added this to the Dart2.1 milestone Sep 4, 2018
@bwilkerson bwilkerson modified the milestones: Dart2.1, PostDart2.1 Sep 4, 2018
@aadilmaan aadilmaan modified the milestones: Future, D25 Release Jun 4, 2019
@aadilmaan aadilmaan modified the milestone: Future Jun 4, 2019
@stereotype441
Copy link
Member

Given @lrhn's comment, I'm reclassifying this as a language issue.

@stereotype441 stereotype441 added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). and removed analyzer-command Issues with the command-line dartanalyzer tool area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. needs-info We need additional information from the issue author (auto-closed after 14 days if no response) labels Jul 25, 2019
@lrhn lrhn removed the P2 A bug or feature request we're likely to work on label Aug 31, 2020
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). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

8 participants