Skip to content

Method type inference should only infer speakable types #31557

@jcouv

Description

@jcouv
void M<T>(T x)
{
  if (x == null) throw null;
  var y = Identity(x); 
  // currently we infer Identity<T!> (which you could not write explicitly), but should be Identity<T>
}
T Identity<T>(T z) => z;

The change should include inference of var and best type (new [] { x }). Those inferred types should be speakable too.

From LDM discussion 2018-05-12
FYI @AlekseyTs @cston

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions