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
Method missing for prepended module #6445
Comments
Yup this is a bug for sure, but it may be the same cause as #4531, especially since moving things around fixes it. I guess this needs to be a higher priority and fixed in 9.3. |
For @donv original snippet I notice that they seem to have fixed the oddity raised in the original report: 2.7 and lower:
3.0:
Based on this and how I would expect things to work I would expect the 3.0 behavior. So MRI must have fixed this lookup at some point. I would not use this pattern an expect 'Stuff M' since it will stop working. With that said JRuby dispatches to X like we would expect but then the super does not find M. At this point I feel like for 9.2/3/4 we should make it behave like 3.0 but that obviously has a potential to be reported again. I will examine the other bugs to see how closely they seem to the same problem or not. |
So in talking yesterday we figured out a few things.
So one idea we are considering (which will only be 9.3+ due to risk) is to change our IncludedModuleWrapper (PrependedModule) to just contain a reference to the original modules method map. This involves changing alot of code which tends to do something like: included_module.get_non_included_module.search_method. It will become included_module.search_method. Sounds simple? It is all over and there are likely other things we have not considered but it is the current thing to correct this behavior. |
Fixed in PR #6777 |
Hi!
I have a mismatch in behaviour between JRuby and MRI, and a bonus question :-)
Given the following snippet:
MRI outputs:
while JRuby fails with this output:
Unless this is illegal Ruby, I guess JRuby should behave the same as MRI.
Bonus question:
Why is the
stuff
method of module X not called when using MRI? If I move the definition of class A below the call to M.prepend it works.Environment Information
jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94 OpenJDK 64-Bit Server VM 11.0.7+10 on 11.0.7+10 +jit [darwin-x86_64]
Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
Any help is appreciated :-)
The text was updated successfully, but these errors were encountered: