Skip to content

Optional arguments regression #3384

@mmusu3

Description

@mmusu3

Input code

class OptionalArgumentTest
{
    static void Test()
    {
        Test2();
        Test3();
        Test4();
    }

    static void Test2(int a = 0) { }
    static void Test3(int a = 0, int? b = null) { }
    static void Test4(int? b = null, int a = 0) { }
}

Erroneous output

internal class OptionalArgumentTest
{
    private static void Test()
    {
        Test2();
        Test3(0, null);
        Test4(null);
    }

    private static void Test2(int a = 0)
    {
    }

    private static void Test3(int a = 0, int? b = null)
    {
    }

    private static void Test4(int? b = null, int a = 0)
    {
    }
}

The output compiles but the nullable types do not respect the OptionalArguments decompiler setting. Other parameter types still work. This is a regression, the version I used previously was 90946ae

Details

  • Product in use: e.g. ILSpy 9.0 VS extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDecompilerThe decompiler engine itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions