-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
frog handling null incorrectly #595
Comments
When I run the second one on the VM, it prints 'null', which is the only sane behaviour. For I am running with --enable_type_checks so I expect correct behaviour. (Without --enable_type_checks you might argue that the NPE is a kind of type check on the receiver, so anything goes.) This example has no exceptions to the issue: |
Added Triaged label. |
Added this to the FrogEditor milestone. |
Yeah, I would expect the negative tests to fail with --enable_type_checks. I'm kind of surprised they aren't working already. I think it happens because operators aren't correctly dispatched as "var". Regarding the toString issue--I'm not sure what to do there. We either need to give up on undefined being a synonym for null, or generate uglier string interp/concat and toString code. |
btw, the toString issue should be addressed in this separate bug: http://code.google.com/p/dart/issues/detail?id=618 |
BTW, I think the fix for: ...will fix this too. |
Marked this as being blocked by #596. |
This comment was originally written by jimhug@google.com Also for the record, I tried these tests in dartc. Dartc does correctly handle the "f() + 7" case; however, it is equally broken as frog on the "7 + f()" case - although dartc seems to return NaN instead of 7. Nevertheless, we will fix this as part of the editor milestone. cc @kasperl. |
This comment was originally written by jimhug@google.com Set owner to jimhug@google.com. |
This comment was originally written by jimhug@google.com r3505 fixes the specific issues reported in this bug and generally improves null handling in frog. Added Fixed label. |
svn r1844
There are a variety of cases where frog is handling null incorrectly. A few examples are below:
f() => null;
main() {
print (~f());
}
f() => null;
main() {
print(f());
}
running the VM produces an error in both cases:
NullPointerException
0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:315 col:3
1. Function: '::.main' url: '/Users/dgrove/repo/dart-bleeding/dart/frog/y.dart' line:4 col:7
running frog produces "0" in both cases.
Another example:
f() => null;
main() {
print(f() + 7);
}
frog produces "7", the VM throws an exception.
The text was updated successfully, but these errors were encountered: