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

Recursive splat expansion error when mounting Shared::Field #1299

Closed
matthewmcgarvey opened this issue Nov 6, 2020 · 10 comments · Fixed by #1774
Closed

Recursive splat expansion error when mounting Shared::Field #1299

matthewmcgarvey opened this issue Nov 6, 2020 · 10 comments · Fixed by #1774
Labels

Comments

@matthewmcgarvey
Copy link
Member

matthewmcgarvey commented Nov 6, 2020

Describe the bug
When creating a form, we attempted to move a Shared::Field that did not pass a block (it relied on the default text_input override) to the first input above the email field. We started getting a compilation error like:

mount Shared::FieldErrors, attribute
^----
Error: recursive splat expansion: String, Avram::PermittedAttribute(String | Nil), ...

It only happens when the first field is using the override that provides a block.

To Reproduce

Here is a branch that has the failing code in a spec. I did try to simplify it, but I'm sure it could be made more straight forward. https://github.com/matthewmcgarvey/lucky/tree/recursive-splat-expansion

The diff:
master...matthewmcgarvey:recursive-splat-expansion

Expected behavior

Any ordering of mounted fields should work.

Versions (please complete the following information):

  • Lucky version (check in shard.lock): v0.24.0
  • Crystal version (crystal --version): v0.35.1
  • OS: MacOS
@matthewmcgarvey
Copy link
Member Author

So the problem goes away if I move the methods into the component or I inline the mount code. There is a bug on crystal for this error message, could I have stumbled onto this problem? crystal-lang/crystal#7164

@matthewmcgarvey
Copy link
Member Author

Verified to still be an issue on Crystal v0.36.1

@snadon
Copy link
Contributor

snadon commented Jan 28, 2022

I was able to remove my workaround with Lucky 0.29 and Crystal 1.3.2. Not sure when the problem went away though.

@matthewmcgarvey
Copy link
Member Author

matthewmcgarvey commented Jan 28, 2022

Screen Shot 2022-01-27 at 8 19 56 PM

Verified to still be an issue on Crystal v1.3.0 (and v1.3.2 just to be sure) 😢

@asterite
Copy link

What's the full error with --error-trace?

@matthewmcgarvey
Copy link
Member Author

Screen Shot 2022-01-29 at 1 05 52 PM

@flipsasser
Copy link

I'm still bedeviled by this in 2022. Anyone have an ideas?

@jwoertink
Copy link
Member

@flipsasser are you using Crystal 1.6.2? Are you able to give Crystal 1.7.0-dev a try to see if that gives you the same issue?

@flipsasser
Copy link

@jwoertink upgrading solved it! I was still on 1.4.2. My fault. Thanks for the tip!

@jwoertink
Copy link
Member

Sweet! Yeah, I think this is fixed now with the later version of Crystal... Though, we say we support 1.4.0 or later... maybe that needs to be bumped up 🤔

This was referenced Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants