Skip to content

Records: Disallow ref kinds in positional members  #45008

@jcouv

Description

@jcouv

We should disallow ref kinds: record C(ref int i);.
Not sure what we want to do with params: record C(params int[] i)

We should also clarify what we want to do for default values:

record C(int X = 42) // should probably be an error, since we're silently dropping the default value 42
{
   public int X { get; init; } = 43;
}

Maybe we do: "no parameter default values when the property isn't synthesized" or maybe we just disallow default values for now.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions