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

generate_needy_initializer does not allow a default value of false #978

Closed
wezm opened this issue Nov 25, 2019 · 4 comments
Closed

generate_needy_initializer does not allow a default value of false #978

wezm opened this issue Nov 25, 2019 · 4 comments
Labels

Comments

@wezm
Copy link
Contributor

wezm commented Nov 25, 2019

I tried to define a field:

  needs required : Bool = false

but I get the error:

There was a problem expanding macro 'generate_needy_initializer'

Code in macro 'finished'

 1 | generate_needy_initializer
     ^
Called macro defined in lib/lucky/src/lucky/html_builder.cr:46:3

 46 | macro generate_needy_initializer

Which expanded to:

 > 15 |
 > 16 |
 > 17 |            @required : Bool,
                   ^
Error: argument must have a default value

It would appear that this line does not handle false:

{% has_default = declaration.value || declaration.value == nil %}

@jwoertink jwoertink added the bug label Nov 25, 2019
@bdtomlin
Copy link
Contributor

@jwoertink I have a few minutes this afternoon if you would like a PR for this. Just want to make sure no one else is working on it since it's a quickie:)

@jwoertink
Copy link
Member

@bdtomlin Have at it! I'm definitely not working on a solution for this, so that'd be great.

@paulcsmith
Copy link
Member

This has been on my todo list for a long time so your help would be greatly appreciated @bdtomlin :D

@wezm
Copy link
Contributor Author

wezm commented Dec 23, 2019

Fixed by #979

@wezm wezm closed this as completed Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants