Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix: Restore visit_ImportFrom and remove double registration
  • Loading branch information
amritamishra01 authored Dec 11, 2025
commit 90b2ce3444ea2f5240e2ad0592f8a1206274afd2
5 changes: 4 additions & 1 deletion src/lpython/semantics/python_ast_to_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4873,6 +4873,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
}

// --- RESTORED visit_ImportFrom ---
// --- 1. The Missing Function (RESTORE THIS) ---
void visit_ImportFrom(const AST::ImportFrom_t &x) {
if (!x.m_module) {
throw SemanticError("Not implemented: The import statement must currently specify the module name", x.base.base.loc);
Expand Down Expand Up @@ -4945,7 +4946,8 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
}
tmp = nullptr;
}
// --- YOUR FIXED visit_Import ---

// --- 2. Your Fixed Function (CORRECT VERSION WITHOUT 'ELSE') ---
void visit_Import(const AST::Import_t &x) {
ASR::symbol_t *t = nullptr;
std::string rl_path = get_runtime_library_dir();
Expand Down Expand Up @@ -4988,6 +4990,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
current_module_dependencies.push_back(al, s2c(al, mod_sym));
}

// ALIAS LOGIC (No else block!)
if (alias) {
std::string alias_str = std::string(alias);
if (current_scope->get_symbol(alias_str) == nullptr) {
Expand Down