Skip to content

Allow FunctionTypes to work in place of InterfaceType in applicability check #2109

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 5 commits into from
Jan 6, 2020

Conversation

jcollins-g
Copy link
Contributor

Fixes #2101.

For CallableGenericTypeAliasElementType, use the FunctionType as the instantiated type, and adjust callers so they can use any DartType and not assume InterfaceType.

Also refactors to extract potentially applicable extension detection into a mixin to support a future implementation of #2107.

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Jan 2, 2020
@coveralls
Copy link

coveralls commented Jan 3, 2020

Coverage Status

Coverage increased (+0.008%) to 93.937% when pulling fea0b0d on functiontypeimpl-crash into 285b4df on master.

Copy link
Contributor

@scheglov scheglov left a comment

Choose a reason for hiding this comment

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

I don't understand this code and logic well enough, but OTOH I don't see definitely wrong things.


@override
InterfaceType get interfaceType => (type as TypeParameterType).bound;
InterfaceType get _interfaceType => (type as TypeParameterType).bound;
Copy link
Contributor

Choose a reason for hiding this comment

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

The bound of a type parameter is not always InterfaceType.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is just all messed up. Added a todo; will fix if it causes a real world crash.

@jcollins-g jcollins-g merged commit 7807ee1 into master Jan 6, 2020
@jcollins-g jcollins-g deleted the functiontypeimpl-crash branch April 27, 2020 20:40
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.

Unhandled exception: type 'FunctionTypeImpl' is not a subtype of type 'InterfaceType'
4 participants