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] Incorrect extensions reported in a conflict #45887

Open
eernstg opened this issue May 3, 2021 · 1 comment
Open

[analyzer] Incorrect extensions reported in a conflict #45887

eernstg opened this issue May 3, 2021 · 1 comment
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. improve-diagnostics Related to the quality of diagnostic messages 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

@eernstg
Copy link
Member

eernstg commented May 3, 2021

Consider the following program:

extension E on int? { void foo() {} }
extension E1 on int { void foo() {} }
extension E2 on int { void foo() {} }
void main() => 1.foo();

This program causes the analyzer (9ff5ac1) to emit the following error message:

ERROR|COMPILE_TIME_ERROR|AMBIGUOUS_EXTENSION_MEMBER_ACCESS|/usr/local/google/home/eernst/lang/dart/scratch/202105/n001.dart|4|18|3|A member named 'foo' is defined in extensions 'E' and 'E1' and neither is more specific.

However, the conflict actually arises for E1 and E2, not for E and E1, so the error message is wrong. It seems likely that the problem lies in the error message and not in the underlying checks, because we get a correct error message if E is commented out, and we also (correctly) do not get any error messages if E2 is commented out.

@eernstg eernstg added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. improve-diagnostics Related to the quality of diagnostic messages labels May 3, 2021
@scheglov scheglov self-assigned this May 5, 2021
@scheglov scheglov added the P2 A bug or feature request we're likely to work on label May 5, 2021
@scheglov
Copy link
Contributor

scheglov commented May 5, 2021

dart-bot pushed a commit that referenced this issue May 5, 2021
…onflicting extensions.

Bug: #45887
Change-Id: I8ec587b4479e165056766d433cb0a3c459d5f504
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Mar 14, 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. improve-diagnostics Related to the quality of diagnostic messages 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

3 participants