Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion integration_tests/lpython_decorator_02.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from numpy import array
from lpython import i32, i64, f64, lpython, TypeVar
from lpython import i32, i64, f64, lpython, TypeVar, Const

n = TypeVar("n")

Expand All @@ -17,6 +17,10 @@ def multiply_02(n: i32, x: i64[:], y: i64[:]) -> i64[n]:
z[i] = x[i] * y[i]
return z

@lpython
def const_arg_sum(x: Const[i32]) -> i32:
return 10 + x


def test_01():
size = 5
Expand All @@ -30,5 +34,6 @@ def test_01():
z = multiply_02(size, x, y)
for i in range(size):
assert z[i] == x[i] * y[i]
assert const_arg_sum(size) == size + 10

test_01()
2 changes: 2 additions & 0 deletions src/libasr/codegen/asr_to_c_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,8 @@ R"(#include <stdio.h>
}
} case ASR::ttypeType::Logical : {
return "p";
} case ASR::ttypeType::Const : {
return get_type_format(ASR::down_cast<ASR::Const_t>(type)->m_type);
} case ASR::ttypeType::Array : {
return "O";
} default: {
Expand Down