@@ -668,7 +668,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
668
668
call_args_vec.push_back (al, arg);
669
669
}
670
670
}
671
-
671
+
672
672
int64_t find_argument_position_from_name (ASR::Function_t* orig_func, std::string arg_name,
673
673
const Location& call_loc, bool raise_error) {
674
674
int64_t arg_position = -1 ;
@@ -955,7 +955,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
955
955
956
956
ASR::symbol_t *t = get_generic_function (subs, rt_subs, *func);
957
957
std::string new_call_name = (ASR::down_cast<ASR::Function_t>(t))->m_name ;
958
-
958
+
959
959
// Currently ignoring keyword arguments for generic function calls
960
960
Vec<ASR::call_arg_t > new_args;
961
961
new_args.reserve (al, n_pos_args);
@@ -965,7 +965,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
965
965
new_call_arg.loc = args.p [i].loc ;
966
966
new_args.push_back (al, new_call_arg);
967
967
}
968
- return make_call_helper (al, t, current_scope, new_args, new_call_name, loc);
968
+ return make_call_helper (al, t, current_scope, new_args, new_call_name, loc);
969
969
}
970
970
if (args.size () != func->n_args ) {
971
971
std::string fnd = std::to_string (args.size ());
@@ -1099,7 +1099,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
1099
1099
* the restriction
1100
1100
*/
1101
1101
void check_type_restriction (std::map<std::string, ASR::ttype_t *> subs,
1102
- std::map<std::string, ASR::symbol_t *> rt_subs,
1102
+ std::map<std::string, ASR::symbol_t *> rt_subs,
1103
1103
ASR::Function_t* rt, const Location& loc) {
1104
1104
std::string rt_name = rt->m_name ;
1105
1105
if (rt_subs.find (rt_name) != rt_subs.end ()) {
@@ -1110,13 +1110,13 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
1110
1110
throw SemanticError (msg, loc);
1111
1111
}
1112
1112
ASR::Function_t* rt_arg_func = ASR::down_cast<ASR::Function_t>(rt_arg);
1113
- /* * @brief different argument number between the function given and the
1113
+ /* * @brief different argument number between the function given and the
1114
1114
* restriction result in error **/
1115
1115
if (rt->n_args != rt_arg_func->n_args ) {
1116
- std::string msg = " The function " + std::string (rt_arg_func->m_name )
1116
+ std::string msg = " The function " + std::string (rt_arg_func->m_name )
1117
1117
+ " provided for the restriction "
1118
1118
+ std::string (rt->m_name ) + " have different number of arguments" ;
1119
- throw SemanticError (msg, rt_arg->base .loc );
1119
+ throw SemanticError (msg, rt_arg->base .loc );
1120
1120
}
1121
1121
for (size_t j=0 ; j<rt->n_args ; j++) {
1122
1122
ASR::ttype_t * rt_type = ASRUtils::expr_type (rt->m_args [j]);
@@ -1125,7 +1125,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
1125
1125
std::string rt_type_param = ASR::down_cast<ASR::TypeParameter_t>(
1126
1126
ASRUtils::get_type_parameter (rt_type))->m_param ;
1127
1127
/* *
1128
- * @brief if the type of the function given for the restriction does not
1128
+ * @brief if the type of the function given for the restriction does not
1129
1129
* satisfy the type substitution from the function argument, it
1130
1130
* results in error **/
1131
1131
if (!ASRUtils::check_equal_type (subs[rt_type_param], rt_arg_type)) {
@@ -1186,7 +1186,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
1186
1186
ASR::ttype_t * right_type = ASRUtils::expr_type (rt->m_args [1 ]);
1187
1187
left_type = ASR::is_a<ASR::TypeParameter_t>(*left_type)
1188
1188
? subs[ASR::down_cast<ASR::TypeParameter_t>(left_type)->m_param ] : left_type;
1189
- if ((ASRUtils::is_integer (*left_type) && ASRUtils::is_integer (*right_type)) ||
1189
+ if ((ASRUtils::is_integer (*left_type) && ASRUtils::is_integer (*right_type)) ||
1190
1190
(ASRUtils::is_real (*left_type) && ASRUtils::is_integer (*right_type))) {
1191
1191
return ;
1192
1192
}
@@ -1231,7 +1231,7 @@ class CommonVisitor : public AST::BaseVisitor<Derived> {
1231
1231
new_function_num = 0 ;
1232
1232
}
1233
1233
generic_func_nums[func_name] = new_function_num + 1 ;
1234
- std::string new_func_name = " __lpython_generic_" + func_name + " _"
1234
+ std::string new_func_name = " __lpython_generic_" + func_name + " _"
1235
1235
+ std::to_string (new_function_num);
1236
1236
generic_func_subs[new_func_name] = subs;
1237
1237
t = pass_instantiate_generic_function (al, subs, rt_subs, current_scope,
@@ -2981,7 +2981,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
2981
2981
Vec<ASR::dimension_t > dims;
2982
2982
dims.reserve (al, 4 );
2983
2983
2984
- ASR::ttype_t *type = ASRUtils::TYPE (ASR::make_TypeParameter_t (al, x.base .base .loc ,
2984
+ ASR::ttype_t *type = ASRUtils::TYPE (ASR::make_TypeParameter_t (al, x.base .base .loc ,
2985
2985
s2c (al, tvar_name), dims.p , dims.size ()));
2986
2986
2987
2987
ASR::expr_t *value = nullptr ;
@@ -3705,11 +3705,11 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
3705
3705
" Only value and name properties are supported for now." , loc);
3706
3706
}
3707
3707
if ( attr_name == " value" ) {
3708
- tmp = ASR::make_EnumValue_t (al, loc, t, type, enum_type->m_type , nullptr );
3708
+ tmp = ASR::make_EnumValue_t (al, loc, t, enum_type->m_type , nullptr );
3709
3709
} else if ( attr_name == " name" ) {
3710
3710
ASR::ttype_t * char_type = ASRUtils::TYPE (ASR::make_Character_t (al, loc, 1 , -2 ,
3711
3711
nullptr , nullptr , 0 ));
3712
- tmp = ASR::make_EnumName_t (al, loc, t, type, char_type, nullptr );
3712
+ tmp = ASR::make_EnumName_t (al, loc, t, char_type, nullptr );
3713
3713
}
3714
3714
} else if (ASR::is_a<ASR::Pointer_t>(*type)) {
3715
3715
ASR::Pointer_t* p = ASR::down_cast<ASR::Pointer_t>(type);
@@ -3740,8 +3740,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
3740
3740
x.base .base .loc );
3741
3741
}
3742
3742
ASR::Variable_t* enum_member_variable = ASR::down_cast<ASR::Variable_t>(enum_member);
3743
- ASR::ttype_t * enum_ttype = ASRUtils::TYPE (ASR::make_Enum_t (al, x.base .base .loc , t, nullptr , 0 ));
3744
- tmp = ASR::make_EnumValue_t (al, x.base .base .loc , enum_member, enum_ttype,
3743
+ tmp = ASR::make_EnumValue_t (al, x.base .base .loc , enum_member,
3745
3744
enum_member_variable->m_type , ASRUtils::expr_value (enum_member_variable->m_symbolic_value ));
3746
3745
} else {
3747
3746
throw SemanticError (" Only Variable type is supported for now in Attribute" ,
@@ -3768,8 +3767,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
3768
3767
enum_ref_type = enum_ref->m_type ;
3769
3768
enum_ref_value = enum_m_var->m_symbolic_value ;
3770
3769
tmp = ASR::make_EnumValue_t (al, x.base .base .loc , enum_ref->m_v ,
3771
- enum_ref->m_enum_type , enum_ref_type,
3772
- ASRUtils::expr_value (enum_ref_value));
3770
+ enum_ref_type, ASRUtils::expr_value (enum_ref_value));
3773
3771
} else if ( enum_property == " name" ) {
3774
3772
char *s = enum_m_var->m_name ;
3775
3773
size_t s_size = std::string (s).size ();
@@ -3778,7 +3776,7 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
3778
3776
enum_ref_value = ASRUtils::EXPR (ASR::make_StringConstant_t (al, x.base .base .loc ,
3779
3777
s, enum_ref_type));
3780
3778
tmp = ASR::make_EnumName_t (al, x.base .base .loc , enum_ref->m_v ,
3781
- enum_ref-> m_enum_type , enum_ref_type, enum_ref_value);
3779
+ enum_ref_type, enum_ref_value);
3782
3780
}
3783
3781
} else {
3784
3782
visit_AttributeUtil (ASRUtils::expr_type (e), x.m_attr , e, x.base .base .loc );
0 commit comments