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

invalid syntax error when using @d with keyword argument #880

Open
tiemvanderdeure opened this issue Dec 5, 2024 · 3 comments
Open

invalid syntax error when using @d with keyword argument #880

tiemvanderdeure opened this issue Dec 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@tiemvanderdeure
Copy link
Contributor

MWE

using DimensionalData
myfun(a;b) = a * b
z = Z(1:10)
myfun.(z; b = 2) # works
@d myfun.(z; b = 2) # errors

Gives ERROR: syntax: invalid syntax ; b = 2

Must be a bug, right? Or am I missing some reason why this is not allowed?

@rafaqz
Copy link
Owner

rafaqz commented Dec 5, 2024

Some kind of bad AST manipulation in the macro.

Guess there is no test for broadcasts with keywords

(Always assume I just messed it up, it's meant to be identical to base)

@tiemvanderdeure
Copy link
Contributor Author

Thought it was probably you just messed up, just didn't want to be rude :)

@rafaqz
Copy link
Owner

rafaqz commented Dec 5, 2024

Have a go at an AST fix if you feel adventurous... we just need to check for the keyword argument case somewhere.

Maybe we should have used MacroTools.jl to make it a bit easier but I usually just write them directly

@rafaqz rafaqz added the bug Something isn't working label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants