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

Need better warning message when precedence order causes the error #19478

Open
bwilkerson opened this issue Jun 16, 2014 · 3 comments
Open

Need better warning message when precedence order causes the error #19478

bwilkerson opened this issue Jun 16, 2014 · 3 comments
Labels
analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@bwilkerson
Copy link
Member

Given the following code:

class A {
}

class B extends A {
  void b() {}
}

f(bool p) {
  var v1 = p ? new A() : new B()..b();
  var v2 = p ? new A() : (new B()..b());
}

There is a warning on the line defining v1 because the cascade is applied to the result of the conditional operator. But we could notice that the method is defined on the static type of the else-expression and suggest that the problem is the precedence of the cascade operator and that parentheses will fix the problem.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@bwilkerson bwilkerson added Type-Enhancement area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-ux labels Aug 4, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
@srawlins
Copy link
Member

srawlins commented Oct 9, 2023

Still relevant 😁

@srawlins srawlins added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants