Reported in dotnet/csharplang#9517 by @LeQuackers
Needs to be confirmed with WG, but if resolving extensions yields something other than a method, then we should be done (no need to infer natural function type).
[Fact]
public void TODO2()
{
var src = """
public static class Extensions
{
extension(C c)
{
public int M => C.M();
}
}
public class Test
{
public static void Foo()
{
var upper = new C().M; // error CS8917: The delegate type could not be inferred.
}
}
public class C
{
public static int M() => 0;
}
""";
var comp = CreateCompilation(src);
comp.VerifyEmitDiagnostics(
// (14,21): error CS8917: The delegate type could not be inferred.
// var upper = new C().M; // error CS8917: The delegate type could not be inferred.
Diagnostic(ErrorCode.ERR_CannotInferDelegateType, "new C().M").WithLocation(14, 21));
}