Skip to content

Covariant return types with respect to nullable reference types #23268

@sharwell

Description

@sharwell

Version Used: Preview 11152017

Steps to Reproduce:

abstract class A {
  public abstract object? GetData();
}

class B : A {
  public override object GetData() => new object();
}

Expected Behavior:

No warning is reported.

Actual Behavior:

CS8609 is reported for B.GetData().


Update (jcouv, 3/29/2019): as part of this, if I do b.GetData().ToString(), there should be no warning. Confirmed with Mads.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions