Explode method expansion

Somewhere along the way the block argument gets dropped.
Even though `method` is a `Def` that accepts a block, the `&block` portion is dropped.
Possible Crystal compiler bug.
This commit is contained in:
Michael Miller 2022-03-19 16:13:11 -06:00
parent 15dd2ea6f1
commit 17e97cb39a
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
2 changed files with 29 additions and 4 deletions

View file

@ -5,7 +5,7 @@ Spectator.describe Spectator::Double do
Spectator::Double.define(FooBarDouble, "dbl-name", foo: 42, bar: "baz")
# The subject `dbl` must be carefully used in sub-contexts, otherwise it pollutes parent scopes.
# This changes the type of `dbl` to `Double`, which produces a union of methods and their return types.
# This changes the type of `dbl` to `Double+`, which produces a union of methods and their return types.
context "plain double" do
subject(dbl) { FooBarDouble.new }
@ -38,6 +38,10 @@ Spectator.describe Spectator::Double do
it "uses nil for undefined messages" do
expect { dbl.baz }.to compile_as(Nil)
end
it "supports blocks" do
dbl.bar
end
end
context "without a double name" do