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 Object.delegate to setter #5964

Merged
merged 1 commit into from Apr 19, 2018

Conversation

straight-shoota
Copy link
Member

Setters can only receive one argument but the method produced by delegate would forward splash and double-splash arguments, resulting in a syntax error:

delegate "foo=", to: bar
# before:
def foo(*args, **options)
  bar.foo=(*args, **options) # Syntax error in expanded macro: expecting token ')', not ','
end
# now:
def foo(arg)
  bar.foo= arg
end

Copy link
Contributor

@RX14 RX14 left a comment

Choose a reason for hiding this comment

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

It'd be nice if setters just accepted splats (in their "raw call" form), for the sake of consistency. But this is fine.

@RX14 RX14 added this to the Next milestone Apr 19, 2018
@RX14 RX14 merged commit 34078b8 into crystal-lang:master Apr 19, 2018
@straight-shoota straight-shoota deleted the jm/fix/delegate-setter branch April 19, 2018 12:29
chris-huxtable pushed a commit to chris-huxtable/crystal that referenced this pull request Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants