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

Introduce rules to say that missing formal parameter type means dynamic #2163

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Mar 22, 2022

The language specification definition of function declarations in section 'Function Declarations' has not been updated for a long time. Unfortunately, the definition is inconsistent with the usage of that phrase elsewhere in the spec. With this PR, we're consistently considering a function declaration as a broad concept (e.g., it includes constructors, operators, getters, and external functions).

With a consistently broad definition of function declarations in place, this PR then introduces the rule (in section 'Formal Parameters') that an omitted type annotation on a formal parameter yields the declared type dynamic, and also mentions that the declared type isn't omitted if it is provided by override inference.

@eernstg eernstg requested a review from lrhn March 22, 2022 16:37
@github-actions
Copy link

github-actions bot commented Mar 22, 2022

Visit the preview URL for this PR (updated for commit 83b48d4):

https://dart-specification--pr2163-specify-dynamic-para-axp7en66.web.app

(expires Wed, 30 Mar 2022 12:57:39 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6941ecd630c4f067ff3d02708a45ae0f0a42b88a

%% TODO(eernst): Change to \ref{} when inference spec is added.
Briefly, override inference yields a type computed from the declared types of
the corresponding parameter of member signatures in superinterfaces,
or it causes a compile-time error if said types can not be reconciled.%
Copy link
Member

Choose a reason for hiding this comment

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

Do you also want to mention inference from initializing formals here too since you include constructors under this umbrella now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thanks!

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