Skip to content

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

Open
eernstg wants to merge 2 commits into
mainfrom
specify_dynamic_parameter_type_mar22
Open

Introduce rules to say that missing formal parameter type means dynamic#2163
eernstg wants to merge 2 commits into
mainfrom
specify_dynamic_parameter_type_mar22

Conversation

@eernstg

@eernstg eernstg commented Mar 22, 2022

Copy link
Copy Markdown
Member

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

github-actions Bot commented Mar 22, 2022

Copy link
Copy Markdown

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

Comment thread specification/dartLangSpec.tex Outdated
%% 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
Copy Markdown
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
Copy Markdown
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