Skip to content

Add introductory section plus specification of abbreviated constructor declarations#4688

Merged
eernstg merged 3 commits into
mainfrom
spec_abbreviated_constructors_may26
May 13, 2026
Merged

Add introductory section plus specification of abbreviated constructor declarations#4688
eernstg merged 3 commits into
mainfrom
spec_abbreviated_constructors_may26

Conversation

@eernstg
Copy link
Copy Markdown
Member

@eernstg eernstg commented May 7, 2026

This PR adds a short introductory section about the abbreviated constructor syntax which is part of the primary constructor feature bundle, and it specifies the meaning of the abbreviated constructor declarations. For example:

class MyClass(final int i) {
  new(int j) : this(j + 1); // Rather than `MyClass(int j) ...`.
}

@eernstg eernstg requested a review from lrhn May 7, 2026 16:14
Comment thread accepted/future-releases/primary-constructors/feature-specification.md Outdated
Copy link
Copy Markdown
Member

@munificent munificent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from a style nit about the space before (, LGTM!

Comment thread accepted/future-releases/primary-constructors/feature-specification.md Outdated
@eernstg
Copy link
Copy Markdown
Member Author

eernstg commented May 13, 2026

I built the tools from the HEAD of SDK, and dart format suddenly does not include the space in new (); and factory ();. That's surprising because I thought we had discussed this, and the behavior of the formatter confirmed that assumption. Anyway, I removed the space and the commentary about why it was there.

@eernstg eernstg merged commit b8c4a38 into main May 13, 2026
4 checks passed
@eernstg eernstg deleted the spec_abbreviated_constructors_may26 branch May 13, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants