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

new warning: operator negate should return a numeric type on vector and matrix types #3850

Closed
DartBot opened this issue Jun 23, 2012 · 2 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-duplicate Closed in favor of an existing report

Comments

@DartBot
Copy link

DartBot commented Jun 23, 2012

This issue was originally filed by joh...@johnmccutchan.com


Upgrading to the latest version of DartEditor I noticed a new warning for the following code:

  /// Returns a new vec2 from -this
  vec2 operator negate() => new vec2(-x, -y);

The warning is: operator negate should return a numeric type.

Vectors and matrices are numeric types and I expect to be able to use negate on them. Can this be relaxed?

Thanks,
John

@sethladd
Copy link
Contributor

Redirecting to Analyzer first to verify correct behavior.


Added Area-Analyzer, Triaged labels.

@bwilkerson
Copy link
Member

Version 0.10 of the spec states

  It is a static warning if the return type of the user-declared operator
  negate is explicitly declared and not a numerical type.

This requirement will probably be removed in version 0.11 (as indicated by http://code.google.com/p/dart/issues/detail?id=3765), and if so editor will then relax the restriction, but we are currently waiting to see whether that change is actually approved. You can follow the editor's progress using this issue: http://code.google.com/p/dart/issues/detail?id=3768.


Added Duplicate label.
Marked as being merged into #3768.

@DartBot DartBot added Type-Defect area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. closed-duplicate Closed in favor of an existing report labels Jun 28, 2012
This issue was closed.
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. closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

3 participants