-
Notifications
You must be signed in to change notification settings - Fork 171
Fix symbolic pass for handling IntrinsicElementalFunction
in print()
#2665
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
Merged
ubaidsk
merged 8 commits into
lcompilers:main
from
kmr-srbh:fix-symblic-pass-for-printing-intrinsic-elemental-function
Apr 27, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a4255b3
Fix symbolic pass for handling `IntrinsicElementalFunction` in `print()`
kmr-srbh 5647cd5
Tests: Add tests and update references
kmr-srbh 98383c6
Fix mistakenly commented out lines
kmr-srbh 325600e
Tests: Add testcase and update references
kmr-srbh 07a9957
Tests: Update references
kmr-srbh 5ac67be
Style changes
kmr-srbh 25969e8
Remove C backend
kmr-srbh 1e15742
Tests: Add asserts and update test reference
kmr-srbh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from lpython import i32 | ||
|
||
def test_intrinsic_function_mixed_print(): | ||
# list and list methods | ||
my_list: list[i32] = [1, 2, 3, 4, 5] | ||
print("Popped element:", my_list.pop()) | ||
assert my_list == [1, 2, 3, 4] | ||
|
||
print("1 is located at:", my_list.index(1)) | ||
assert my_list.index(1) == 0 | ||
|
||
my_list.append(2) | ||
print("2 is present", my_list.count(2), "times") | ||
assert my_list.count(2) == 2 | ||
|
||
print(my_list.pop(), my_list) | ||
assert my_list == [1, 2, 3, 4] | ||
|
||
# dict and dict methods | ||
my_dict: dict[str, i32] = {"first": 1, "second": 2, "third": 3} | ||
print("Keys:", my_dict.keys()) | ||
print("Value of 'third':", my_dict.pop("third")) | ||
assert len(my_dict.keys()) == 2 | ||
|
||
test_intrinsic_function_mixed_print() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/reference/runtime-test_intrinsic_function_mixed_print-a862825.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"basename": "runtime-test_intrinsic_function_mixed_print-a862825", | ||
"cmd": "lpython {infile}", | ||
"infile": "tests/../integration_tests/test_intrinsic_function_mixed_print.py", | ||
"infile_hash": "b0f779598e5d9868d183f1032fb3f87c131fedacf7848aaed6c4d238", | ||
"outfile": null, | ||
"outfile_hash": null, | ||
"stdout": "runtime-test_intrinsic_function_mixed_print-a862825.stdout", | ||
"stdout_hash": "a8d2083be043accf4ebe8c6a3e8a2427d492323b12d0c041ba79f10e", | ||
"stderr": null, | ||
"stderr_hash": null, | ||
"returncode": 0 | ||
} |
6 changes: 6 additions & 0 deletions
6
tests/reference/runtime-test_intrinsic_function_mixed_print-a862825.stdout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Popped element: 5 | ||
1 is located at: 0 | ||
2 is present 2 times | ||
2 [1, 2, 3, 4] | ||
Keys: ['second', 'third', 'first'] | ||
Value of 'third': 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.