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

No analyzer error for [expression][unary_operator][expression] #36255

Closed
greglittlefield-wf opened this issue Mar 19, 2019 · 2 comments
Closed
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@greglittlefield-wf
Copy link
Contributor

greglittlefield-wf commented Mar 19, 2019

While editing some code, I accidentally removed an &&, and the code ended up something like this:

if (a !b && c && d) {}

I got a runtime error for a !b, but didn't receive an analyzer error as I'd expect to.

This also reproduces with the ~ operator:

main() {
  var a, b;
  // No analyzer error
  // Runtime error: "Error: The string '!' isn't a user-definable operator."
  var result1 = a !b;
  // No analyzer error
  // Runtime error: "Error: The string '~' isn't a user-definable operator."
  var result2 = a ~b;
}

Reproducible in Dart 2.2.0

@lrhn lrhn added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Mar 19, 2019
@lrhn
Copy link
Member

lrhn commented Mar 19, 2019

@askeksa-google @peter-ahe-google
The front end could perhaps also do with a more precise error message.

@peter-ahe-google
Copy link
Contributor

The example program above leads to a spurious error about non-nullable types and causes an infinite loop in the parser.

@danrubel

@danrubel danrubel self-assigned this Mar 19, 2019
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. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants