-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Closed
Copy link
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-CompilersArea-Language DesignBugFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesLanguage-C#
Milestone
Description
[Fact]
public void Constraints_65()
{
var source =
@"
#nullable disable
interface I1
{
void F1<TF1>();
}
#nullabe enable
class A : I1
{
public void F1<TF1A>() where TF1A : object
{}
}
";
var comp = CreateCompilation(new[] { source, NonNullTypesTrue, NonNullTypesAttributesDefinition });
// PROTOTYPE(NullableReferenceTypes): unexpected warning
comp.VerifyDiagnostics(
// (21,17): warning CS8633: Nullability in constraints for type parameter 'TF1A' of method 'A.F1<TF1A>()' doesn't match the constraints for type parameter 'TF1' of interface method 'I1.F1<TF1>()'. Consider using an explicit interface implementation instead.
// public void F1<TF1A>() where TF1A : object
Diagnostic(ErrorCode.WRN_NullabilityMismatchInConstraintsOnImplicitImplementation, "F1").WithArguments("TF1A", "A.F1<TF1A>()", "TF1", "I1.F1<TF1>()").WithLocation(21, 17)
);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
4 - In ReviewA fix for the issue is submitted for review.A fix for the issue is submitted for review.Area-CompilersArea-Language DesignBugFeature - Nullable Reference TypesNullable Reference TypesNullable Reference TypesLanguage-C#