Skip to content

better symboltable error message #5184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
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: 2 additions & 2 deletions compiler/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ impl Compiler {
self.check_forbidden_name(&name, usage)?;

let symbol_table = self.symbol_table_stack.last().unwrap();
let symbol = symbol_table.lookup(name.as_ref()).expect(
"The symbol must be present in the symbol table, even when it is undefined in python.",
let symbol = symbol_table.lookup(name.as_ref()).unwrap_or_else(||
panic!("The symbol '{name}' must be present in the symbol table, even when it is undefined in python."),
);
let info = self.code_stack.last_mut().unwrap();
let mut cache = &mut info.name_cache;
Expand Down