This test incorrectly expects that WeakReference.target should be
cleared for a weakly reachable object. WeakReference specification
doesn't guarantee that:
a9f684e624/sdk/lib/core/weak.dart (L75-L76)
This change fixes the test to give up after certain number of
iterations instead of hanging forever.
Issue: https://github.com/dart-lang/sdk/issues/55518
Change-Id: Ief0ebe1452c83058a35fc1ba87e5a83924d43919
TEST=corelib/weak_reference_test
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363960
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
The recent rewrite of [0] kept the existing semantics of the finalizer
implementation but migrated to the new interop semantics.
Turns out in that existing semantics there's a bug, namely that it
casted the peer object of to a non-nullable [Object] which is incorrect.
This CL
* fixes the cast to non-nullable [Object]
* moves the (currently) web-specific tests for
[Finalizer]/[WeakReference] into `corelib` so it runs on all backends
* expands the finalizer tests to check finalizers get invoked
* expands the weak reference test to ensure weak reference is cleared
[0] https://dart-review.googlesource.com/c/sdk/+/363082/
Issue https://github.com/dart-lang/sdk/issues/55474
Change-Id: Ibd8c186b39100cff9e2f437f1a737034a5364830
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363581
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>