Skip to content

Commit 2e95f6f

Browse files
committed
Invalidation must be done after inserting the new module
* Otherwise we could read the new Assumption but still miss the update which was done after.
1 parent bfe53f9 commit 2e95f6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/truffleruby/core/module/ModuleFields.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ public void include(RubyContext context, Node currentNode, RubyModule module) {
295295
private void performIncludes(ModuleChain inclusionPoint, Deque<RubyModule> moduleAncestors) {
296296
while (!moduleAncestors.isEmpty()) {
297297
RubyModule mod = moduleAncestors.pop();
298+
inclusionPoint.insertAfter(mod);
298299
// Module#include only adds modules between the current class and the super class,
299300
// so invalidating the current class is enough as all affected lookups would go through the current class.
300301
newMethodsVersion(mod.fields.getMethodNames());
301-
inclusionPoint.insertAfter(mod);
302302
}
303303
}
304304

@@ -337,8 +337,8 @@ public void prepend(RubyContext context, Node currentNode, RubyModule module) {
337337
if (!(mod instanceof PrependMarker)) {
338338
final RubyModule actualModule = mod.getActualModule();
339339
if (!ModuleOperations.includesModule(rubyModule, actualModule)) {
340-
moduleFieldsToInvalidate.newMethodsVersion(actualModule.fields.getMethodNames());
341340
cur.insertAfter(actualModule);
341+
moduleFieldsToInvalidate.newMethodsVersion(actualModule.fields.getMethodNames());
342342
cur = cur.getParentModule();
343343
}
344344
}

0 commit comments

Comments
 (0)