Skip to content

Commit 1f9f9f8

Browse files
committed
[Truffle] Don't remove an autoloaded constant on failure.
1 parent 17e56c7 commit 1f9f9f8

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

spec/truffle/tags/core/module/autoload_tags.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ fails:Module#autoload loads the registered constant when it is opened as a class
22
fails:Module#autoload loads the registered constant when it is opened as a module
33
fails:Module#autoload does not load the file if the file is manually required
44
fails:Module#autoload ignores the autoload request if the file is already loaded
5-
fails:Module#autoload does not remove the constant from the constant table if load fails
65
fails:Module#autoload does not remove the constant from the constant table if the loaded files does not define it
76
fails:Module#autoload loads the file when opening a module that is the autoloaded constant
87
fails:Module#autoload looks up the constant when in a meta class scope

truffle/src/main/java/org/jruby/truffle/nodes/dispatch/UnresolvedDispatchNode.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ private Object doRubyBasicObject(
207207
requireNode = insert(KernelNodesFactory.RequireNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{}));
208208
}
209209

210-
module.removeConstant(this, (String) methodName);
211-
212210
requireNode.require((RubyString) constant.getValue());
213211

214212
return doRubyBasicObject(frame, first, receiverObject, methodName, blockObject, argumentsObjects);

truffle/src/main/java/org/jruby/truffle/runtime/core/RubyModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ private void setConstantInternal(RubyNode currentNode, String name, Object value
211211
getConstants().put(name, new RubyConstant(this, value, false, autoload));
212212
} else {
213213
// TODO(CS): warn when redefining a constant
214+
// TODO (nirvdrum 18-Feb-15): But don't warn when redefining an autoloaded constant.
214215
getConstants().put(name, new RubyConstant(this, value, previous.isPrivate(), autoload));
215216
}
216217

0 commit comments

Comments
 (0)