Steps to reproduce
Method definitions are below.
class Foo
def bar(baz)
baz
end
def hoge(fuga)
fuga
end
end
Test code is below.
RSpec.describe Foo do
describe '#bar' do
it do
foo = Foo.new
baz = double
expect(foo.bar(baz)).to be_kind_of RSpec::Mocks::Double
end
end
describe '#hoge' do
it do
foo = Foo.new
fuga = double
expect(foo.hoge(fuga)).to be_kind_of RSpec::Mocks::Double
end
it do
foo = Foo.new
fuga = 'double'
expect(foo.hoge(fuga)).to be_kind_of String
end
end
end
Expected behavior
For union type, I would like to see the test double excluded. In contrast, if it is not union type, it should be untyped.
class Foo
# @rbs (untyped) -> untyped
def bar(baz)
baz
end
# @rbs (String) -> (String)
def hoge(fuga)
fuga
end
end
Actual behavior
Test double would be included.
class Foo
# @rbs (RSpec::Mocks::Double) -> RSpec::Mocks::Double
def bar(baz)
baz
end
# @rbs (RSpec::Mocks::Double | String) -> (RSpec::Mocks::DoubleString | String)
def hoge(fuga)
fuga
end
end
System configuration
- ruby: 3.4.2
- rbs-trace: 0.5.0
- rbs: 3.9.2
Steps to reproduce
Method definitions are below.
Test code is below.
Expected behavior
For union type, I would like to see the test double excluded. In contrast, if it is not union type, it should be
untyped.Actual behavior
Test double would be included.
System configuration