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

Create an implementation of MultiplyDefinedElement2 #57041

Closed
DanTup opened this issue Nov 6, 2024 · 2 comments
Closed

Create an implementation of MultiplyDefinedElement2 #57041

DanTup opened this issue Nov 6, 2024 · 2 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on

Comments

@DanTup
Copy link
Collaborator

DanTup commented Nov 6, 2024

Currently the class MultiplyDefinedElement2 doesn't appear to be implemented in the new element model. This makes it difficult to migrate code like that in https://dart-review.googlesource.com/c/sdk/+/387387 that inspects the conflictingElements.

Making MultiplyDefinedElementImpl implements MultiplyDefinedElement2 requires an implementation of Fragment firstFragment and List<Element2> conflictingElements2.

@bwilkerson @scheglov it turns out, there is a MultiplyDefinedFragment class already defined in element2.dart, though it also has no implementations. I feel like this might be the right way to solve this, though I'm not sure what the implementation of MultiplyDefinedFragment looks like (for ex. does it have a conflictingFragments? what are nextFragment and previousFragment?).

For the case I'm migrating for now I'm going to drop this, but since there's other code using MultiplyDefinedElement this probably needs solving before the migration is complete.

@DanTup DanTup added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Nov 6, 2024
@scheglov
Copy link
Contributor

scheglov commented Nov 6, 2024

I think MultiplyDefinedFragment should be synthetic, without any next / previous fragments. The fragments of the conflicting elements are not fragments of the MultiplyDefinedElement2. It has a fragment at all just because it has to, but there is nothing useful in it.

@scheglov scheglov self-assigned this Nov 7, 2024
@scheglov
Copy link
Contributor

scheglov commented Nov 7, 2024

For MultiplyDefinedFragment the enclosingFragment is... what?
Here we can theoretically say that this is the LibraryFragment that has conflicting imports.

https://dart-review.googlesource.com/c/sdk/+/394180

@scheglov scheglov added the P2 A bug or feature request we're likely to work on label Nov 7, 2024
copybara-service bot pushed a commit that referenced this issue Nov 7, 2024
Bug: #57041
Change-Id: I4272137f6b48dfa784d23d0f9fc206b3bad12819
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394180
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
@scheglov scheglov closed this as completed Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

2 participants