Inconsistent parenthesization requirements for single-argument additional constructors (with new
)
#16257
Labels
Milestone
new
)
#16257
A single-argument additional constructor (i.e., a non-primary constructor declared with
new
) must have parentheses around its argument only if it is followed by another additional constructor.Repro steps
This:
can be simplified to
Likewise:
can become
But if there's another constructor and it comes after the single-argument one:
the parentheses must stay
The removal of the parentheses has a significant effect on the way the following additional constructors are parsed:
Expected behavior
Parentheses should either always be required for a single-argument additional constructor, or they should never be required.
Actual behavior
Parentheses are required for a single-argument additional constructor only if it is not the last additional constructor.
Known workarounds
N/A.
Related information
Provide any related information (optional):
.NET SDK 8.0.100-rc.2.23502.2 (and probably long before).
The text was updated successfully, but these errors were encountered: