Skip to content

Commit 779ff70

Browse files
committed
ASR: Fix derived_type points outside symtab
Fixes error: ASR verify: Struct::m_derived_type cannot point outside of its symbol table
1 parent b2d0853 commit 779ff70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,11 +958,11 @@ class CommonVisitor : public AST::BaseVisitor<Struct> {
958958
ASR::symbol_t *der_sym = ASRUtils::symbol_get_past_external(s);
959959
if( der_sym ) {
960960
if ( ASR::is_a<ASR::StructType_t>(*der_sym) ) {
961-
return ASRUtils::TYPE(ASR::make_Struct_t(al, loc, der_sym, dims.p, dims.size()));
961+
return ASRUtils::TYPE(ASR::make_Struct_t(al, loc, s, dims.p, dims.size()));
962962
} else if( ASR::is_a<ASR::EnumType_t>(*der_sym) ) {
963-
return ASRUtils::TYPE(ASR::make_Enum_t(al, loc, der_sym, dims.p, dims.size()));
963+
return ASRUtils::TYPE(ASR::make_Enum_t(al, loc, s, dims.p, dims.size()));
964964
} else if( ASR::is_a<ASR::UnionType_t>(*der_sym) ) {
965-
return ASRUtils::TYPE(ASR::make_Union_t(al, loc, der_sym, dims.p, dims.size()));
965+
return ASRUtils::TYPE(ASR::make_Union_t(al, loc, s, dims.p, dims.size()));
966966
}
967967
}
968968
}

0 commit comments

Comments
 (0)