@@ -1954,7 +1954,7 @@ class CommonVisitor : public AST::BaseVisitor<StructType> {
19541954 " str annotation" , loc);
19551955 }
19561956 // TODO: Change the returned type from Class to StructType
1957- return ASRUtils::TYPE (ASR::make_ClassType_t (al,loc,sym));
1957+ return ASRUtils::TYPE (ASRUtils::make_StructType_t_util (al, loc, sym, false ));
19581958 }
19591959
19601960 throw SemanticError (" Only Name, Subscript, and Call supported for now in annotation of annotated assignment." , loc);
@@ -4652,6 +4652,27 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
46524652 size_t default_arg_index = i - default_arg_index_start;
46534653 this ->visit_expr (*(x.m_args .m_defaults [default_arg_index]));
46544654 init_expr = ASRUtils::EXPR (tmp);
4655+ ASR::ttype_t * init_expr_type = ASRUtils::expr_type (init_expr);
4656+
4657+
4658+ if (ASR::is_a<ASR::String_t>(*ASRUtils::type_get_past_allocatable (init_expr_type))) {
4659+ ASR::down_cast<ASR::String_t>(ASRUtils::type_get_past_allocatable (init_expr_type))->m_physical_type =
4660+ ASR::string_physical_typeType::DescriptorString;
4661+ ASR::down_cast<ASR::String_t>(ASRUtils::type_get_past_allocatable (init_expr_type))->m_len_kind =
4662+ ASR::string_length_kindType::DeferredLength;
4663+ }
4664+
4665+ Vec<ASR::alloc_arg_t > alloc_args; alloc_args.reserve (al, 1 );
4666+ ASR::alloc_arg_t alloc_arg;
4667+ alloc_arg.loc = loc;
4668+ alloc_arg.m_a = init_expr;
4669+ alloc_arg.m_dims = nullptr ;
4670+ alloc_arg.n_dims = 0 ;
4671+ alloc_arg.m_type = nullptr ;
4672+ alloc_arg.m_len_expr = nullptr ;
4673+ alloc_args.push_back (al, alloc_arg);
4674+ init_expr = ASRUtils::EXPR (ASR::make_Allocate_t (al, loc, alloc_args.p , 1 , nullptr , nullptr , nullptr ));
4675+
46554676 }
46564677 if (s_intent == ASRUtils::intent_unspecified) {
46574678 s_intent = ASRUtils::intent_in;
@@ -6463,7 +6484,8 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
64636484 }
64646485 tmp = ASR::make_StructInstanceMember_t (al, loc, val, member_sym,
64656486 member_var_type, nullptr );
6466- } else if ( ASR::is_a<ASR::ClassType_t>(*type) ) { // TODO: Remove ClassType_t from here
6487+ // TODO: Check if necessary
6488+ /* } else if( ASR::is_a<ASR::ClassType_t>(*type) ) { //TODO: Remove ClassType_t from here
64676489 ASR::ClassType_t* der = ASR::down_cast<ASR::ClassType_t>(type);
64686490 ASR::symbol_t* der_sym = ASRUtils::symbol_get_past_external(der->m_class_type);
64696491 ASR::Struct_t* der_type = ASR::down_cast<ASR::Struct_t>(der_sym);
@@ -6515,7 +6537,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
65156537 }
65166538 }
65176539 tmp = ASR::make_StructInstanceMember_t(al, loc, val, member_sym,
6518- member_var_type, nullptr );
6540+ member_var_type, nullptr);*/
65196541 } else if (ASR::is_a<ASR::EnumType_t>(*type)) {
65206542 ASR::EnumType_t* enum_ = ASR::down_cast<ASR::EnumType_t>(type);
65216543 ASR::Enum_t* enum_type = ASR::down_cast<ASR::Enum_t>(enum_->m_enum_type );
@@ -8265,8 +8287,8 @@ we will have to use something else.
82658287 st = get_struct_member (st, call_name, loc);
82668288 } else if ( ASR::is_a<ASR::Variable_t>(*st)) {
82678289 ASR::Variable_t* var = ASR::down_cast<ASR::Variable_t>(st);
8268- if (ASR::is_a<ASR::StructType_t>(*var->m_type ) ||
8269- ASR::is_a<ASR::ClassType_t>(*var->m_type ) ) {
8290+ if (ASR::is_a<ASR::StructType_t>(*var->m_type ) /* || //TODO: Check if necessary
8291+ ASR::is_a<ASR::ClassType_t>(*var->m_type)*/ ) {
82708292 // TODO: Correct Class and ClassType
82718293 // call to struct member function
82728294 // modifying args to pass the object as self
0 commit comments