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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the suggestion in the error when an interface is used as a type #281

Merged
merged 1 commit into from Aug 4, 2020

Conversation

turbolent
Copy link
Member

The suggestion in the error message that is reported when an interface is used as a type and not in a restricted type as expected was wrong when the interface is not at the root of the type, but inside another type.

For example, for an incorrect type {Int: SomeInterface}, the suggestion was AnyStruct{{Int: SomeInterface}}, but should be {Int: AnyStruct{SomeInterface}}.

Fix this by recursively rewriting the type (if needed), instead of just rewriting at root of the type.

Discovered by @MaxStalker in his live-stream 馃檹

recursively rewrite instead of just at root of type
@turbolent turbolent self-assigned this Aug 1, 2020
Copy link
Contributor

@benjaminkvm benjaminkvm left a comment

Choose a reason for hiding this comment

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

Good catch!

@turbolent turbolent merged commit af04532 into master Aug 4, 2020
@turbolent turbolent deleted the bastian/fix-interface-type-use-error-suggestion branch August 4, 2020 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants