[Fact]
public void DynamicInvocation()
{
var source =
@"class C
{
static void F(object x, object y)
{
}
static void G(object? x, dynamic y)
{
F(x, y);
if (x != null) F(y, x);
}
}";
var comp = CreateCompilationWithMscorlib40AndSystemCore(new[] { source, NonNullTypesTrue, NonNullTypesAttributesDefinition });
// PROTOTYPE(NullableReferenceTypes): We should be able to report warnings
// when all applicable methods agree on the nullability of particular parameters.
// (For instance, x in F(x, y) above.)
comp.VerifyDiagnostics();
}
[Fact]
public void DynamicObjectCreation_02()
{
var source =
@"class C
{
C(object x, object y)
{
}
static void G(object? x, dynamic y)
{
var o = new C(x, y);
if (x != null) o = new C(y, x);
}
}";
var comp = CreateCompilationWithMscorlib40AndSystemCore(new[] { source, NonNullTypesTrue, NonNullTypesAttributesDefinition });
// PROTOTYPE(NullableReferenceTypes): We should be able to report warnings
// when all applicable methods agree on the nullability of particular parameters.
// (For instance, x in F(x, y) above.)
comp.VerifyDiagnostics();
}