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

ObjectMap bug, js #9026

Closed
romamik opened this issue Dec 12, 2019 · 2 comments
Closed

ObjectMap bug, js #9026

romamik opened this issue Dec 12, 2019 · 2 comments

Comments

@romamik
Copy link
Contributor

@romamik romamik commented Dec 12, 2019

class Test {
    static function main() {
        var key = {};
        var map: Map<{}, Int> = new Map();
        map[key] = 10;
        map[key] = 20;
        trace(map);
    }
}

outputs:

{{
	__id__ : 1
} => 20, {
	__id__ : 1
} => 20}

This is because in ObjectMap.hx first assignId returns 0, which is treated as false in next call to expression getId(key) || assignId(key) and assignId is called again on the same object.
Tested with haxe 4.0.3.

@Simn

This comment has been minimized.

Copy link
Member

@Simn Simn commented Dec 12, 2019

-_-

@kLabz

This comment has been minimized.

Copy link
Contributor

@kLabz kLabz commented Dec 12, 2019

Worked with 3.4.4 (try.haxe.org)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.