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

dart2js does no see hashCode having type int #14951

Closed
sgjesse opened this issue Nov 8, 2013 · 2 comments
Closed

dart2js does no see hashCode having type int #14951

sgjesse opened this issue Nov 8, 2013 · 2 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@sgjesse
Copy link
Contributor

sgjesse commented Nov 8, 2013

When running dart2js on the following program

main() {
  var o = new Object();
  print((1 + o.hashCode) & 0xFF);
}

I get the warning

test.dart:3:9: Warning: No operator '&' in class 'num'.
  print((1 + o.hashCode) & 0xFF);

If o is types as Object the warning goes away. That is compiling the following two programs gives no warnings.

main() {
  Object o = new Object();
  print((1 + o.hashCode) & 0xFF);
}

main() {
  print((1 + new Object().hashCode) & 0xFF);
}

@rakudrama
Copy link
Member

Still happens. This is a problem with the type checker.

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
@srawlins
Copy link
Member

srawlins commented Aug 9, 2019

dart2js now prints 71, no longer errors.

@srawlins srawlins closed this as completed Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

5 participants