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

Methods of classes has dynamic hashCode #11712

Closed
DartBot opened this issue Jul 6, 2013 · 5 comments
Closed

Methods of classes has dynamic hashCode #11712

DartBot opened this issue Jul 6, 2013 · 5 comments
Labels
area-vm closed-obsolete Closed as the reported issue is no longer relevant type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented Jul 6, 2013

This issue was originally filed by @dangreen


Example:

class Test {

    Test(){
        print(m.hashCode);
        print(m.hashCode);
        print(m.hashCode);
    }

    void m() => true;

}

main(){
    var t = new Test();
}

will be printed three different hashCode

@DartBot
Copy link
Author

DartBot commented Jul 6, 2013

This comment was originally written by @dangreen


Its true only for Dartium, in dart2js output data will be equal

@iposva-google
Copy link
Contributor

Please note that you are creating three different Function objects in the above code. Everytime you call the getter m, you will get a new closure object.


Added Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jul 10, 2013

This comment was originally written by @dangreen


"m" is not getter , is a Function object.

@iposva-google
Copy link
Contributor

I am sorry if this was not clear: The access to "m" within the constructor of Test() will call the getter for m on the object being constructed. Since there is not getter "m", but there is a method "m()" an implicit getter will be created returning a newly allocated Function object each time you call it.

@DartBot
Copy link
Author

DartBot commented Jul 11, 2013

This comment was originally written by @dangreen


for me it very unexpected behavior of VM. But dart2js compile code which works as I expect. Such behavior will remain in dart2js?

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
@iposva-google iposva-google added the closed-obsolete Closed as the reported issue is no longer relevant label May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm closed-obsolete Closed as the reported issue is no longer relevant type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants