diff --git a/spec/std/concurrent_spec.cr b/spec/std/concurrent_spec.cr index 5623c3117e02..1fd0a67c1799 100644 --- a/spec/std/concurrent_spec.cr +++ b/spec/std/concurrent_spec.cr @@ -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) + end end diff --git a/src/concurrent.cr b/src/concurrent.cr index fb52a3a46335..20680ccefb29 100644 --- a/src/concurrent.cr +++ b/src/concurrent.cr @@ -105,7 +105,7 @@ macro spawn(call, *, name = nil) {% end %} ) { spawn(name: {{name}}) do - {{call.name}}( + {% if call.receiver %}{{ call.receiver }}.{% end %}{{call.name}}( {% for arg, i in call.args %} __arg{{i}}, {% end %}