Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow doc comments to use formal parameter initializer scope #3494

Merged

Conversation

parlough
Copy link
Member

@parlough parlough commented Dec 6, 2023

Since initializing formals are not added to the formal parameter scope, doc comments can't access them. If the initializing formal parameter scope exists, doc comments should be allowed to use them. That way constructors can reference super parameters.

I've never adjusted the spec before, so please review closely :) - For example, with this exception, is it not clear what the scope for other constructors is supposed be? Should the function one expand its text?

\cc @eernstg

@lrhn lrhn requested a review from eernstg December 22, 2023 08:24
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good! However, I've suggested a few changes.

This is mostly in order to follow the pretty-much-unwritten rules of the language specification (like: "which occurrences of a phrase will give rise to an index entry?" or "where do we put line breaks in LaTeX source?"), but also one thing that affects the meaning directly: We should have a link between the generative constructor case and the "otherwise" case. I've suggested putting the narrowest case first and then covering everything else by starting the next paragraph with 'Otherwise'.

@parlough
Copy link
Member Author

Thanks for the feedback @eernstg, I applied your suggestions! Starting with the narrowest case makes a lot of sense, I didn't consider that :)

One final question: In terms of the spec, is the otherwise case stating "function" sufficient for also covering constructors not covered in the special case?

@parlough parlough requested a review from eernstg December 29, 2023 15:22
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

The word 'function' does cover constructors:

and constructor declarations (\ref{constructors});
.

@parlough
Copy link
Member Author

parlough commented Jan 10, 2024

The word 'function' does cover constructors:

Makes sense. Thanks for confirming :)

@eernstg Feel free to land if you're happy with this change. I don't have commit access on this repository. Thanks again!

@eernstg
Copy link
Member

eernstg commented Jan 10, 2024

OK, thanks! Landing.

@eernstg eernstg merged commit d0d1659 into dart-lang:main Jan 10, 2024
@parlough parlough deleted the feat/initializing-formal-doc-comments branch January 10, 2024 19:03
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.

2 participants