We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Okay, not a good title, but this one is rather weird :P
class EqualMatcher def initialize(@other) end def matches(obj) obj == @other end end class Expectation def initialize(@target) end def to(matcher) pp self pp @target unless matcher.matches(@target) end end Expectation.new([1]).to EqualMatcher.new([1]) Expectation.new([1, nil]).to EqualMatcher.new([1, nil]) Expectation.new([1] == [1]).to EqualMatcher.new(true)
Output:
self = #<Expectation(Array(Int32)):0x13A9FA0 @target=[1]> self = #<Expectation(Array((Int32 | Nil))):0x13A9F20 @target=[1, nil]> self = #<Expectation(Bool):0x13ABFB0 @target=false> @target = false
Changing to EqualMatcher to
EqualMatcher
class EqualMatcher(T) def initialize(@other : T) end def matches(obj) obj == @other end end
fixes the result (no @target = false in the output). My guess is a missing error case / exception.
@target = false
The text was updated successfully, but these errors were encountered:
This one is a serious one.
A smaller code, but having the same issue, is this one:
class Base def some(other : self) false end def some(other) false end end class Foo(T) < Base def some(other : Foo) true end end a = Foo(Int32).new b = Foo(Int32).new || Foo(Int32 | Nil).new || true a.some(b) c = Foo(Int32).new z = c.some(c) puts z
Outputs "false" instead of "true".
Sorry, something went wrong.
d877401
No branches or pull requests
Okay, not a good title, but this one is rather weird :P
Output:
Changing to
EqualMatcher
tofixes the result (no
@target = false
in the output). My guess is a missing error case / exception.The text was updated successfully, but these errors were encountered: