diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 517b40dd9a..cb5287543c 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -832,6 +832,7 @@ RUN(NAME callback_04 IMPORT_PATH .. LABELS cpython) RUN(NAME intrinsics_01 LABELS cpython llvm llvm_jit NOFAST) # any RUN(NAME intrinsics_02 LABELS cpython llvm llvm_jit c) # floordiv RUN(NAME test_builtin_type LABELS cpython llvm llvm_jit c) # type +RUN(NAME test_builtin_type_set LABELS cpython llvm llvm_jit) # type (specifically for `set`) # lpython decorator RUN(NAME lpython_decorator_01 LABELS cpython) diff --git a/integration_tests/test_builtin_type.py b/integration_tests/test_builtin_type.py index 5fc81eadfa..188313444f 100644 --- a/integration_tests/test_builtin_type.py +++ b/integration_tests/test_builtin_type.py @@ -6,6 +6,7 @@ def test_builtin_type(): s: str = "Hello, LPython!" l: list[i32] = [1, 2, 3, 4, 5] d: dict[str, i32] = {"a": 1, "b": 2, "c": 3} + t: tuple[str, i32] = ("a", 1) res: str = "" res = str(type(i)) @@ -23,5 +24,9 @@ def test_builtin_type(): res = str(type(d)) print(res) assert res == "" + res = str(type(t)) + print(res) + assert res == "" + test_builtin_type() diff --git a/integration_tests/test_builtin_type_set.py b/integration_tests/test_builtin_type_set.py new file mode 100644 index 0000000000..d0265b1c1a --- /dev/null +++ b/integration_tests/test_builtin_type_set.py @@ -0,0 +1,11 @@ +from lpython import i32 + +def test_builtin_type_set(): + st: set[i32] = {1, 2, 3, 4} + + res: str = str(type(st)) + print(res) + assert res == "" + + +test_builtin_type_set() diff --git a/src/libasr/pass/intrinsic_functions.h b/src/libasr/pass/intrinsic_functions.h index 879f5bf134..efe6b96091 100644 --- a/src/libasr/pass/intrinsic_functions.h +++ b/src/libasr/pass/intrinsic_functions.h @@ -542,6 +542,10 @@ namespace ObjectType { object_type += "list"; break; } case ASR::ttypeType::Dict : { object_type += "dict"; break; + } case ASR::ttypeType::Set : { + object_type += "set"; break; + } case ASR::ttypeType::Tuple : { + object_type += "tuple"; break; } default: { LCOMPILERS_ASSERT_MSG(false, "Unsupported type"); break;