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

Fix resolve generic argument in block output type restriction mismatch #11186

Conversation

straight-shoota
Copy link
Member

When a type restriction on a block argument's output type does not match, the error message failed to resolve generic type arguments:

Array(Int32).new(1) { "String" } # => Error: expected block to return T, not String

This patch fixes that, the error message is now expected block to return Int32, not String.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic labels Sep 8, 2021
Copy link
Member

@sdogruyol sdogruyol left a comment

Choose a reason for hiding this comment

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

Needs a crystal tool format, other than that LGTM 👍 Thanks 🙏

@straight-shoota straight-shoota added this to the 1.2.0 milestone Sep 14, 2021
@straight-shoota straight-shoota merged commit e7991c7 into crystal-lang:master Sep 17, 2021
@straight-shoota straight-shoota deleted the fix/block-generic-type-error branch September 17, 2021 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants