Skip to content

Override modelType to match return type in TypeParameters interface #1755

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

Merged
merged 3 commits into from
Sep 17, 2018

Conversation

askeksa-google
Copy link

The implementation of the modelType getter inherited by most classes is the one in ModelElement, which returns ElementType. In TypeParameters, this getter is overridden by an abstract getter which returns DefinedElementType, a subclass of ElementType.

Some subclasses of ModelElement mix in TypeParameters without providing an implementation of modelType returning DefinedElementType, which means that their implementation of modelType is not a valid override of the one in its interface.

This error is currently caught by neither the CFE nor the analyzer, but it will be reported by the CFE following the fix for dart-lang/sdk#32014.

This PR inserts stubs for checking the type at runtime, similarly to what is already done in the TopLevelVariable class.

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Sep 17, 2018
Copy link
Contributor

@jcollins-g jcollins-g left a comment

Choose a reason for hiding this comment

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

Yep, this is definitely a bug. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants