Skip to content

Commit db69dd6

Browse files
authored
Merge pull request #1349 from Smit-create/i-1348
Fix tuple arguments type in function
2 parents a0fc10f + 59cc6e9 commit db69dd6

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

integration_tests/test_tuple_02.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,21 @@ def f():
2626
assert t1[3] == complex(55, 55)
2727
print(t1[0], t1[1], t1[2], t1[3])
2828

29-
f()
29+
30+
def g_check(x: tuple[i32, i32], y: tuple[i32, i32]) -> bool:
31+
return x[0] == y[0]
32+
33+
def test_issue_1348():
34+
a11: tuple[i32, i32]
35+
b11: tuple[i32, i32]
36+
a11 = (1, 2)
37+
b11 = (1, 2)
38+
assert g_check(a11, b11)
39+
40+
41+
def check():
42+
f()
43+
test_issue_1348()
44+
45+
46+
check()

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,20 +2973,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
29732973
break;
29742974
}
29752975
case (ASR::ttypeType::Tuple) : {
2976-
ASR::Tuple_t* asr_tuple = ASR::down_cast<ASR::Tuple_t>(asr_type);
2977-
std::string type_code = ASRUtils::get_type_code(asr_tuple->m_type,
2978-
asr_tuple->n_type);
2979-
std::vector<llvm::Type*> llvm_el_types;
2980-
for( size_t i = 0; i < asr_tuple->n_type; i++ ) {
2981-
bool is_local_array_type = false;
2982-
int local_n_dims = 0;
2983-
int local_a_kind = -1;
2984-
ASR::storage_typeType local_m_storage = ASR::storage_typeType::Default;
2985-
llvm_el_types.push_back(get_arg_type_from_ttype_t(asr_tuple->m_type[i], m_abi,
2986-
arg_m_abi, local_m_storage, arg_m_value_attr, local_n_dims,
2987-
local_a_kind, is_local_array_type, ASRUtils::intent_local));
2988-
}
2989-
type = tuple_api->get_tuple_type(type_code, llvm_el_types)->getPointerTo();
2976+
type = get_type_from_ttype_t_util(asr_type)->getPointerTo();
29902977
break;
29912978
}
29922979
case (ASR::ttypeType::List) : {

0 commit comments

Comments
 (0)