Skip to content

Inference should use generic bounds to infer argument types #1761

Closed
@natebosch

Description

@natebosch

I generally don't expect that specifying a generic which exactly matches what would be inferred should impact behavior, but it changes how arguments are inferred.

For example

void something<T extends Object>(void Function(T) c) {}

void main() {
  something<Object>((arg) {});
  something((arg) {});
 }

In both cases the generic T takes the value Object, however in the latter case the arg has an inferred type of Object? instead of Object.

cc @leafpetersen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions