Open jinangshah21 opened 4 days ago
In #5282 Type declared Subroutine was made supported, I think this is related to that.
Use the diff and then investigate pass_array_by_data.cpp
diff --git a/src/libasr/pass/transform_optional_argument_functions.cpp b/src/libasr/pass/transform_optional_argument_functions.cpp
index 1b40359c6..7904a4562 100644
--- a/src/libasr/pass/transform_optional_argument_functions.cpp
+++ b/src/libasr/pass/transform_optional_argument_functions.cpp
@@ -374,10 +374,13 @@ bool fill_new_args(Vec<ASR::call_arg_t>& new_args, Allocator& al,
// `x.n_args` (as it only represents the "FunctionCall" arguments)
// hence to adjust for that, `is_method` introduces an offset
bool is_method = is_class_procedure && (!is_nopass);
+ std::cout<<"is_method: "<<is_method<<std::endl;
+ std::cout<<"x.n_args: "<<x.n_args<<std::endl;
new_args.reserve(al, func->n_args);
for( size_t i = 0, j = 0; j < func->n_args; j++, i++ ) {
- LCOMPILERS_ASSERT(i < x.n_args + is_method);
+ std::cout<<"i: "<<i<<std::endl;
+ LCOMPILERS_ASSERT(i <= x.n_args + is_method);
if( std::find(sym2optionalargidx[func_sym].begin(),
sym2optionalargidx[func_sym].end(), j)
!= sym2optionalargidx[func_sym].end() ) {
MRE :
LFortran Error :