Skip to content

Map literal type arguments sometimes aren't inferred with --no-implicit-dynamic #31013

Closed
@nex3

Description

@nex3

If I analyze the following code with --no-implicit-dynamic:

void fn(Map<dynamic, dynamic> map) {}

void main() {
  fn({1: "foo"});
}

I get this error:

  error • Missing type arguments for map literal at test.dart:4:6 • strong_mode_implicit_dynamic_map_literal

I'd expect the map's type arguments to be inferred from the values I used, or maybe to be inferred as dynamic since I'm passing it to fn(); either way, I don't expect an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestlegacy-area-analyzerUse area-devexp instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions