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
Make new Map() return an instance of the same type as '{}'. #5803
Comments
Added Accepted label. |
Removed this from the M4 milestone. |
This is a trivial change. We should either do it now, or decide not to do it. Removed Priority-Medium label. |
Please do this. |
Added Fixed label. |
Removed this from the M5 milestone. |
Marked this as blocking #12877. |
The specification doesn't say which type to use for '{}', but it must iterate the elements of a literal in key source order.
This is currently done by using a LinkedHashMap to preserve insertion order.
Doing "new Map()" gives a HashMap, not a LinkedHashMap.
The two should give the same type (or compatible subclasses), so "{}" and "new Map()" are equivalent.
The text was updated successfully, but these errors were encountered: