-
Notifications
You must be signed in to change notification settings - Fork 172
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
Indexing error in existing_or_new_singleton_class
#2287
Comments
I'm still investigating but have narrowed it down to this: # lib/httplog/adapters/http.rb
module ::HTTP
class Client
define_method request_method do |req, options|
@response = send(orig_request_method, req, options)
end
end
end |
I think there might be multiple layers. The top level reference on the module could be the issue. Maybe we're not deleting that prefix in some operation (since we always store entries without the leading But another possible issue might be the fact that we're indexing |
Hello! I ran into a very similar error. I think @vinistock's comment is correct, that # this errored
module ::Example1
class Example2
class << self
def example3
end
end
end
end |
@zachahn-gusto are you on the latest server gem? This does not error for me. |
Yes I am! 0.17.14. To be honest, I wasn't really able to reproduce this issue consistently. I'll see if I can find a better test case. |
Quick update, I wasn't able to make it crash, but here's a test case that demonstrates what I'm seeing def test_indexing_singleton
index(<<~RUBY)
module ::Foo
class Bar
class << self
end
end
end
RUBY
# We want to explicitly verify that we didn't introduce the leading `::` by accident, but `Index#[]` deletes the
# prefix when we use `refute_entry`
entries = @index.instance_variable_get(:@entries)
assert_empty(entries.keys.select { _1.start_with?("::") })
end That fails with this error:
|
Ah, that's another part of the bug we missed indeed. I'm cutting a PR for that. |
As reported in #1897 (comment), indexing the httplog gem is failing.
The text was updated successfully, but these errors were encountered: