Skip to content

NNBD tool suggests casts for map keys #49106

Closed
@rakudrama

Description

@rakudrama

The NNBD migration tool suggests casts for keys to Map.operator[].
This operation has argument type Object?, so these casts are unnecessary, and in this case actually harmful since the code relies on lookups outside the map key type returning null.

Example from sdk/pkg/compiler/js/rewrite_async.dart

image

An additional problem is that the migration tool will insert as Block without ensuring Block is imported, and does not use the library prefix. Both problems with the inserted cast create broken migrated code.

/cc @stereotype441 @leafpetersen

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-migration (deprecated)Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool).

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions