Skip to content

WeakReference constructor doesn't reject object that is not supported as an Expando key #48264

@sgrekhov

Description

@sgrekhov

According to the WeakReference documentation

Not all objects are supported as targets for weak references. The WeakReference constructor will reject any object that is not supported as an Expando key.

But, in fact, it doesn't

    WeakReference wr = WeakReference<String>("Lily was here"); // No error here
    print(wr.target); 

Expando does not work on numbers, strings, booleans, null, dart:ffi pointers, dart:ffi structs, or dart:ffi unions. All of these objects must be rejected by WeakReference constructor

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions