Skip to content

Commit 88924ec

Browse files
committed
No need to invalidate the autoload constant if it is already published
1 parent fb34cc3 commit 88924ec

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/org/truffleruby/language/constants/GetConstantNode.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ protected Object autoloadConstant(
146146
public static void autoloadConstantStart(RubyContext context, RubyConstant autoloadConstant, Node currentNode) {
147147
autoloadConstant.getAutoloadConstant().startAutoLoad(context, currentNode);
148148

149-
// We need to notify cached lookup that we are autoloading the constant, as constant
150-
// lookup changes based on whether an autoload constant is loading or not (constant
151-
// lookup ignores being-autoloaded constants).
152-
autoloadConstant.getDeclaringModule().fields.newConstantVersion(autoloadConstant.getName());
149+
if (!autoloadConstant.getAutoloadConstant().isPublished()) {
150+
// We need to notify cached lookup that we are autoloading the constant, as constant
151+
// lookup changes based on whether an autoload constant is loading or not (constant
152+
// lookup ignores being-autoloaded constants).
153+
autoloadConstant.getDeclaringModule().fields.newConstantVersion(autoloadConstant.getName());
154+
}
153155
}
154156

155157
@TruffleBoundary

0 commit comments

Comments
 (0)