-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
class method returns one value, but is_a?(<this value>) contradicts. Can't debug #2376
Comments
Original value, where this String comes from ( o = @original_object
pp o.class # => Class
pp o.is_a?(Class) # => false |
Seems to be somehow related to |
Narrowed down even more: # somewhere in CallStub#fetch
pp found
v = found[1]
pp v.class # => Mocks::Registry::ResultWrapper(Mocks::Registry::Result(Array(String)))
pp v.is_a?(Mocks::Registry::ResultWrapper(Mocks::Registry::Result(Array(String)))) # => false And if I look at |
Apparently, if I actually do pp v.is_a?(Mocks::Registry::ResultWrapper(Mocks::Registry::Result(Mocks::Registry::NoArgs))) # => true Segmentation fault goes away (probably because type system finally figures out the type?). |
Now next test fails, when the value is of type So there is some problem with type system now. Or at least it work differently from what it was before. |
I can't even access its |
The type there should definitely contain a union, like |
I was unable to minimize the code-to-reproduce and to pinpoint the problem. Rather I have stopped confusing the type system and re-written the |
@waterlink If you can point me to a revision or some code that exhibits the bug I can try to reduce it and fix it. Thanks! |
@asterite Do you mean the revision of |
@waterlink I mean some code of yours that I can do |
@asterite Here you go: https://github.com/waterlink/mocks.cr/tree/7222b92155e9272c42a67c57ac851ecaad284d6d git clone https://github.com/waterlink/mocks.cr -b 7222b92155e9272c42a67c57ac851ecaad284d6d && cd ./mocks.cr
crystal spec -v |
Relevant file causing the failure is |
@waterlink Just checked out at that revision and ran |
I am getting this error on
Are you trying to run it on |
When test is run in isolation I get almost the same failure:
|
Linux? |
Yes |
|
I will try inside of |
Same problem inside of clean docker container. |
Strange. Just tried it on a vm (vagrant, the one in the repository, trusty64) and it works fine. |
That is indeed strange. By the way, I have just tried to run it on |
Any way it could be related to Linux Kernel version? To my knowledge, it is the only thing that is shared between docker container and host machine, for practical purposes? |
@waterlink Are you still having this issue? |
Closed in favor of #2665 |
@asterite I have made a clean rewrite, that completely avoided the issue. I am not sure if it is still there now, since old code won't work with new compiler, most probably. |
outputs:
I have no idea what
v
value is, since any way I try to introspect it, it fails with segmentation fault (11).The library was working in
0.13.x
correctly.A method where error happens is here: https://github.com/waterlink/mocks.cr/blob/master/src/mocks/registry.cr#L34-L36
I have no idea how to debug or reduce the code size :( Any help is much appreciated..
The text was updated successfully, but these errors were encountered: