Skip to content

[Proposal]: Relaxed ordering for partial and ref modifiers #9804

@RikkiGibson

Description

@RikkiGibson

Discussion: #8965 (converted from previous champion issue #946)

Summary

Allow the partial modifier to appear in any position in a modifier list on a type or member declaration.
Allow the ref modifier to appear in any position in a modifier list on a struct declaration.

// All errors in this sample would be removed by adopting the proposal:
internal partial class C { }
partial internal class C { } // error

internal ref struct RS { }
ref internal struct RS { } // error

internal ref partial struct RS { }
internal partial ref struct RS { } // error
partial ref internal struct RS { } // error

partial class Program
{
    public partial Program();
    partial public Program() { } // error

    public partial int Prop { get; set; }
    partial public int Prop { get => field; set; } // error

    public partial void Method();
    partial public void Method() { } // error

    partial public event Action Event; // error
    public partial event Action Event { add { } remove { } }
}

Design meetings

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions