Skip to content

Commit

Permalink
Merge pull request #5184 from youknowone/symboltable
Browse files Browse the repository at this point in the history
better symboltable error message
  • Loading branch information
youknowone committed Feb 29, 2024
2 parents e6c6f96 + d26766b commit d0c827e
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit d0c827e

Please sign in to comment.