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

Add nice error message for splatting in macros #1977

Merged
merged 8 commits into from
Jun 5, 2019
Merged

Add nice error message for splatting in macros #1977

merged 8 commits into from
Jun 5, 2019

Conversation

odow
Copy link
Member

@odow odow commented May 26, 2019

Ref #1964. This adds a nice error message, but doesn't enable the functionality, so I haven't gone Closing #1964.

Closes #1964

@mlubin
Copy link
Member

mlubin commented May 26, 2019

The recursive check might be too aggressive. Does it also error at x[some_index_set_generator(args...)]? This should work fine.

@codecov
Copy link

codecov bot commented May 26, 2019

Codecov Report

Merging #1977 into master will increase coverage by 0.07%.
The diff coverage is 95.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1977      +/-   ##
==========================================
+ Coverage   88.77%   88.84%   +0.07%     
==========================================
  Files          33       33              
  Lines        4260     4278      +18     
==========================================
+ Hits         3782     3801      +19     
+ Misses        478      477       -1
Impacted Files Coverage Δ
src/macros.jl 91.37% <95.23%> (+0.29%) ⬆️
src/parse_nlp.jl 90.13% <0%> (+0.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2201c60...1fed241. Read the comment docs.

@odow
Copy link
Member Author

odow commented May 26, 2019

Does it also error at x[some_index_set_generator(args...)]?

D'oh. Much simpler...

@mlubin
Copy link
Member

mlubin commented May 27, 2019

To clarify, x[some_index_set_generator(args...)] should not be an error. The current recursive check for ... would error in this case, right? I think the right check is if any of the index sets are exactly splatting expressions, without a recursive dive into the expression.

src/macros.jl Outdated Show resolved Hide resolved
Copy link
Member

@mlubin mlubin left a comment

Choose a reason for hiding this comment

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

I think we should consider this as closing #1964. I'm not compelled to make splatting work. Users are welcome to work around the macros and create their own containers in that situation.

@odow odow merged commit 42fa4b7 into master Jun 5, 2019
@odow odow deleted the od/splat branch June 5, 2019 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Splatting does not work inside [] for variable declarations
3 participants