dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.31k stars 1.59k forks source link

Failures on Remove unnecessary leftover `@dart=2.19` from tests. #59625

Open lrhn opened 6 days ago

lrhn commented 6 days ago

There are new test failures on Remove unnecessary leftover @dart=2.19 from tests..

The tests

language/const/map_hashcode_override_legacy_test RuntimeError (expected Pass)

are failing on configurations

dart2wasm-asserts-linux-chrome
dart2wasm-linux-chrome
dart2wasm-linux-d8
dart2wasm-linux-jscm-chrome

In 2.19-mode constant maps/sets should not read the hashCode of objects with trivial equality, they should just use identity hash code (except for the lucky few platform objects where it should use the actual hashCode, likely numbers, Symbol and Type objects, because there will be runtime created objects equal to them).

The Wasm code crashes badly if hashCode throws. (That's a silly thing to do, but we have tests.) This was probably accepted already, and just popped up again because I copied/renamed a file.

lrhn commented 6 days ago

(In Dart 3.0, you can't override hashCode and have primitive equality, so a constant hash map won't call a user hashCode, because such an object is not allowed. In Dart \<3.0, that was instead achieved by not calling the hashCode. One strategy here is to close our eyes and wait for Dart \<3.0 to become unsupported, and blame anyone who makes a throwing hashCode until then - because you shouldn't be doing that anyway.)