Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/test_jit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13265,9 +13265,13 @@ def forward(self, x):
checker = FileCheck()
checker.check("Expected a value of type 'int'")
checker.check("return d(\"hello\")")
checker.check("\'b")
checker.check("return c(x)")
checker.check("Submodule.forward\'")
checker.check("return b(x)")
checker.check("M.some_method\'")
checker.check("return y + self.submodule(y)")
checker.check("M.forward\'")
checker.check("return self.some_method(x)")
checker.run(str(e))

Expand Down
7 changes: 6 additions & 1 deletion torch/csrc/jit/script/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2972,7 +2972,12 @@ std::unique_ptr<Function> CompilationUnit::define(
auto creator = [def, _resolver, self](Function& method) {
// Store the function name so that it can be referenced if there is an error
// while compiling this function
ErrorReport::CallStack::push_function(def.name().name());
if (self) {
// Include the fully qualified name if this is a method
ErrorReport::CallStack::push_function(method.qualname().qualifiedName());
} else {
ErrorReport::CallStack::push_function(method.qualname().name());
}
to_ir(def, _resolver, self, method);
// Compilation was successful, so remove the function def info
ErrorReport::CallStack::pop_function();
Expand Down