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

Fix spawn macro for call with receiver #5781

Merged

Conversation

straight-shoota
Copy link
Member

spawn String.new expands to (simplified) spawn { new } because the spawn macro only writes {{ call.name }} and not the receiver.
This PR fixes this by prepending {% if call.receiver %}{{ call.receiver }}.{% end %}.

@@ -41,4 +41,8 @@ describe "concurrent" do
spawn method_named("foo"), name: "foo"
Fiber.yield
end

it "accepts method call with receiver" do
typeof(spawn String.new)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe do something real in the spec?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there's a need for an elaborate test, the basic functionality is already tested. This spec is just to ensure the macro produces valid code.

@ysbaddaden ysbaddaden merged commit 713fa33 into crystal-lang:master Mar 7, 2018
@RX14 RX14 added this to the Next milestone Mar 7, 2018
@straight-shoota straight-shoota deleted the jm/fix/spawn-receiver branch March 7, 2018 11:47
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.

None yet

5 participants