Skip to content

Partial methods should be required to have the same return type #44930

@RikkiGibson

Description

@RikkiGibson

In Visual Studio 16.7 Preview 2.0, the following invalid code can be compiled.

partial class C
{
    public static partial int M();
}

partial class C
{
    public static partial void M() { } // void
}

class Program
{
    static void Main()
    {
        _ = C.M(); // throws InvalidProgram
    }
}

Originally posted by @ufcpp in #43795 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions