You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/contributor/refinements.md
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -88,12 +88,15 @@ The lookup order:
88
88
R1->A->B->R2->D->E->C-> ...
89
89
```
90
90
91
-
The `super` lookup works in much the same way, except `C` ancestors have a higher priority than other active refinements.
91
+
## Super Dispatch
92
92
93
-
The lookup order for `super`:
94
-
```ruby
95
-
R1->A->B->C-> ... ->R2->D->E->C-> ...
96
-
```
93
+
94
+
The `super` lookup [works in two modes](https://bugs.ruby-lang.org/issues/16977):
95
+
96
+
1. If `super` is called from a method is directly in R, then we should search in `C` ancestors and ignore other active refinements.
97
+
2. If `super` is called from a method placed in a module which included to R, then we should search overall active refinements (as we do for a regular lookup).
98
+
99
+
Additionally, `super` has access to the caller active refinements, so we use `InterlaMethod#activeRefinements` to keep and re-use necessary refinements.
0 commit comments