Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for item access from Const data-structures #2579

Merged
merged 33 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5d40049
Add support for accessing items from data-structures within `Const`
kmr-srbh Mar 7, 2024
2fb304a
Update type checking logic for `Const dict`
kmr-srbh Mar 7, 2024
416d1c3
Minor formatting change
kmr-srbh Mar 7, 2024
7077516
Merge branch 'main' into support-const-access
kmr-srbh Mar 8, 2024
e622a9d
Handle negative indices for `const list` and minor formatting changes
kmr-srbh Mar 10, 2024
1a3a5d5
Add tests
kmr-srbh Mar 10, 2024
1f74255
Update test references
kmr-srbh Mar 10, 2024
20aa660
Heavily simplify handling `const`
kmr-srbh Mar 10, 2024
510b65b
Merge branch 'main' into support-const-access
kmr-srbh Mar 11, 2024
32b691e
Tests: Add compile time test
kmr-srbh Mar 12, 2024
0553c04
Merge branch 'main' into support-const-access
kmr-srbh Mar 18, 2024
c8a5020
Merge branch 'main' into support-const-access
kmr-srbh Mar 19, 2024
b62f675
Merge branch 'main' into support-const-access
kmr-srbh Apr 21, 2024
5ebc24f
Merge branch 'main' into support-const-access
kmr-srbh May 1, 2024
cb8a0f2
Remove calls to `type_get_past_const()`
kmr-srbh May 1, 2024
9803138
Tests: Update test references
kmr-srbh May 1, 2024
d8d82ea
Remove extra newline
kmr-srbh May 1, 2024
55ba905
Delete tests/reference/asr-test_const_access-82a9a24.json
kmr-srbh May 1, 2024
89ad7e3
Delete tests/reference/asr-test_const_access-82a9a24.stdout
kmr-srbh May 1, 2024
36a1716
Delete tests/reference/asr-test_const_str_access-59ff543.stderr
kmr-srbh May 1, 2024
b3bbe78
Delete tests/reference/asr-test_const_tuple_access-0d4c6df.json
kmr-srbh May 1, 2024
3da9626
Delete tests/reference/asr-test_const_tuple_access-0d4c6df.stderr
kmr-srbh May 1, 2024
733541e
Delete tests/reference/asr-test_const_str_access-59ff543.json
kmr-srbh May 1, 2024
41514a2
Formatting changes
kmr-srbh May 1, 2024
ed8662d
Tests: Add test to CMakeLists and update error references
kmr-srbh May 1, 2024
e69f52a
Merge branch 'main' into support-const-access
kmr-srbh May 1, 2024
334f429
Update asr_to_llvm.cpp
kmr-srbh May 1, 2024
251b5d4
Undo formatting changes
kmr-srbh May 1, 2024
be48acf
Undo formatting changes
kmr-srbh May 1, 2024
2620956
Revert throwing error for `Const` annotated tuples and strings
kmr-srbh May 1, 2024
c0407b5
Tests: Remove error references
kmr-srbh May 1, 2024
f489720
Remove redundant visitor
kmr-srbh May 1, 2024
970ce8c
Undo moving `index`
kmr-srbh May 1, 2024
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
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ RUN(NAME test_list_compare LABELS cpython llvm llvm_jit)
RUN(NAME test_list_concat LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_list_reserve LABELS cpython llvm llvm_jit)
RUN(NAME test_const_list LABELS cpython llvm llvm_jit)
RUN(NAME test_const_access LABELS cpython llvm llvm_jit)
RUN(NAME test_tuple_01 LABELS cpython llvm llvm_jit c)
RUN(NAME test_tuple_02 LABELS cpython llvm llvm_jit c NOFAST)
RUN(NAME test_tuple_03 LABELS cpython llvm llvm_jit c)
Expand Down
9 changes: 9 additions & 0 deletions integration_tests/test_const_access.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from lpython import i32, Const

CONST_LIST: Const[list[i32]] = [1, 2, 3, 4, 5]
CONST_DICTIONARY: Const[dict[str, i32]] = {"a": 1, "b": 2, "c": 3}

assert CONST_LIST[0] == 1
assert CONST_LIST[-2] == 4

assert CONST_DICTIONARY["a"] == 1
Loading