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

Obscure error when using named argument with reserved name #6559

Closed
oprypin opened this issue Aug 18, 2018 · 2 comments
Closed

Obscure error when using named argument with reserved name #6559

oprypin opened this issue Aug 18, 2018 · 2 comments

Comments

@oprypin
Copy link
Member

oprypin commented Aug 18, 2018

This used to work before Crystal 0.26

class C
  def initialize(@abstract : Bool = false, *args, **kwargs)
  end
end

func = C.new(abstract: true)

But now it gives an error

Error in line 6: read before assignment to local variable '__temp_270'

https://carc.in/#/r/4ro0

Maybe it shouldn't have worked but this kind of error message will not suffice.

@oprypin
Copy link
Member Author

oprypin commented Aug 18, 2018

This should work though

def f(abstract internal_name, **kwargs)
end

f(abstract: true)
Error in line 4: read before assignment to local variable '__temp_269'

@Sija
Copy link
Contributor

Sija commented Aug 18, 2018

Seems like a bug to me, IMO it should possible to use reserved keywords as ivar/property names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants