Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use prepended origin for visibility calculations.
This fixes issues in the ActiveRecord suite with "load_records" could not be found. That method lived in ActiveRecord::Relation module. The root cause of this problem is still a bit unclear, but basically we end up with visibility check trying to compare the prepended version of Relation with a non-prepended version. I have been unable to reproduce it without Rails, though. Say the original Relation module is X. All methods in X know they live in X. When a new module Y gets prepended into X, X's methods must be relocated to a new PrependedModule entry added above the old X in the hierarchy, and their "implementationClass" used for superclass calculation gets set to the new PrependedModule. If we use the implementationClass to calculate visibility, we now have a problem; walking a hierarchy will only find the old X (now the faux prepend base of all X's), while implementationClass will point at the PrependedModule shim. By using the PrependedModule's origin here, we continue to do visibility comparisons against the original X object rather than against the prepended shim.