Skip to content

Commit b644673

Browse files
committed
Make intent_unspecified as default
1 parent 8c906ef commit b644673

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,7 +3764,7 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
37643764
if (x.m_args.m_args[i].m_annotation == nullptr) {
37653765
throw SemanticError("Argument does not have a type", loc);
37663766
}
3767-
ASR::intentType s_intent = ASRUtils::intent_in;
3767+
ASR::intentType s_intent = ASRUtils::intent_unspecified;
37683768
AST::expr_t* arg_annotation_type = get_var_intent_and_annotation(x.m_args.m_args[i].m_annotation, s_intent);
37693769
ASR::ttype_t *arg_type = ast_expr_to_asr_type(x.base.base.loc, *arg_annotation_type);
37703770
// Set the function as generic if an argument is typed with a type parameter
@@ -3793,8 +3793,11 @@ class SymbolTableVisitor : public CommonVisitor<SymbolTableVisitor> {
37933793
std::string arg_s = arg;
37943794
ASR::expr_t *value = nullptr;
37953795
ASR::expr_t *init_expr = nullptr;
3796-
if (ASRUtils::is_array(arg_type)) {
3797-
s_intent = ASRUtils::intent_inout;
3796+
if (s_intent == ASRUtils::intent_unspecified) {
3797+
s_intent = ASRUtils::intent_in;
3798+
if (ASRUtils::is_array(arg_type)) {
3799+
s_intent = ASRUtils::intent_inout;
3800+
}
37983801
}
37993802
ASR::storage_typeType storage_type =
38003803
ASR::storage_typeType::Default;

0 commit comments

Comments
 (0)