Skip to content

ExplicitType and target-typed new #42554

@jcouv

Description

@jcouv

Should we offer some code style options for making the type explicit or implicit in target-typed new?

For example:

  • C c = new();
  • M(new())

Interesting scenarios:

  • (int, int) t = new(); (the refactoring should be blocked to avoid producing illegal code, or made smarter to produce a tuple literal)
  • test existing fixers UseImplicitType (for example, List list = new(); should never offer to make the declaration var)

Relates to #28489 (target-typed new feature)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions