Skip to content

Allow type variables, not just type literals, as type parameters #11033

Closed
@justinfagnani

Description

@justinfagnani

For type checking on certain factory functions, it'd be very nice to allow specifying type parameters from variables, not just literals.

Example:

class A<T> {
  String toString() => "A<$T>";
}

A makeA(Type t) => new A<t>();

main() {
  var a = makeA(String);
  print("a = $a");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions