Skip to content

Better error message for strict-inference #56631

Open
@FMorschel

Description

@FMorschel

I recently found #39277 and the example code it provides is the following:

_createChildren() {
  return [Text("Hello"), Text("Lars"), Text("Testing")];
}

With strict-inference: true the above code triggers an inference_failure_on_function_return_type hint.

But the weird thing is that it also triggers the Add return type assist.

I could not understand the docs on strict-inference for function return types fully, so maybe this is not a bug but it got me thinking on why should it be triggering when it does know how to infer the return type with the assist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).type-questionA question about expected behavior or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions