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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic: Allow macro overload on named args #5808

Merged
merged 7 commits into from Apr 14, 2018

Conversation

bew
Copy link
Contributor

@bew bew commented Mar 11, 2018

I think this is my first PR in the compiler, deep into the semantic pass 馃帀

Fixes #5769

I added a few comments here and there to help me understand what some parts does, I can remove them if needed. I also fixed a bad argument name (a_def => a_macro) in 2 macro-related methods.

I'll add more specs later if you think what I did is correct.
Thank you!

@bew bew force-pushed the allow-macro-overload-on-named-args branch from 0c61cb9 to 9f894c1 Compare March 11, 2018 20:47
@RX14 RX14 requested a review from asterite March 19, 2018 12:33
it "something between 2 macros (I need a name!!!)" do
assert_type(%(
macro foo(*, arg1)
{{ arg1 }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps use 1 and 1_i64 for these two so the spec can tell if the compiler uses the other overload.

Copy link
Contributor Author

@bew bew Mar 28, 2018

Choose a reason for hiding this comment

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

I used 1 and "foo", as I find it easier to directly see the difference in type of these two literals!

!!double_splat == !!other.double_splat
# If they have different number of arguments, splat index or presence of
# double splat, no override.
unless args.size == other.args.size &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd apply de morgan's here

if args.size != other.args.size ||
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@RX14
Copy link
Contributor

RX14 commented Mar 28, 2018

needs a format, somehow you managed to add extra spaces.

@sdogruyol sdogruyol merged commit a327907 into crystal-lang:master Apr 14, 2018
@bew bew deleted the allow-macro-overload-on-named-args branch April 14, 2018 08:40
@bew
Copy link
Contributor Author

bew commented Apr 14, 2018

Cool, thank you 馃槂

@sdogruyol sdogruyol added this to the Next milestone Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Macro is overwritten by different named arguments
3 participants