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

Always add explicit return types in getter/property macros #10405

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

Sija
Copy link
Contributor

@Sija Sija commented Feb 16, 2021

Resolves #10402

@@ -676,7 +676,7 @@ class Object
\{% if name.is_a?(TypeDeclaration) %}
{{var_prefix}}\{{name.var.id}} : \{{name.type}}?

def {{method_prefix}}\{{name.var.id}}? : \{{name.type}}?
def {{method_prefix}}\{{name.var.id}}? : \{{name.type}}
Copy link
Member

Choose a reason for hiding this comment

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

This is technically a breaking change because currently getter? foo : String { nil } is valid. But I'd consider that a bug.

@straight-shoota straight-shoota added breaking-change kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:macros labels Feb 16, 2021
@asterite asterite merged commit 0a338cd into crystal-lang:master Feb 17, 2021
@asterite asterite added this to the 1.0.0 milestone Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:macros
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getter with lazy value doesn't provide an explicit return type
3 participants