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

Integration tests for #2828 #2879

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3047fdd
[ReplaceRefByLiteral] transformation first draft
hbrunie Dec 16, 2024
04573fe
[ReplaceRefByLiteral] replace in ArrayType shape.
hbrunie Dec 17, 2024
4ee2824
[gitignore] venv and .vscode
hbrunie Dec 17, 2024
8d3c9b4
[ReplaceRefByLiteral] initial value always literal
hbrunie Dec 17, 2024
fdb3738
[ReplaceRefByLiteral] 80 chars exceeded
hbrunie Dec 17, 2024
b19b6a7
[ReplaceRefByLiteral] add test showing limit of trans
hbrunie Dec 17, 2024
bfe75cc
[ReplaceRefByLit] flake8
hbrunie Dec 17, 2024
5b06c5b
[RefbyLiteral] flake8 + test sucess
hbrunie Dec 17, 2024
5387311
Merge branch 'master' into replace_ref_by_literal
hbrunie Dec 17, 2024
dcf29a4
Merge branch 'master' into replace_ref_by_literal
hbrunie Jan 15, 2025
ff98ba7
#2828 fix license date.
hbrunie Jan 15, 2025
c31f4b9
#2828 fix module description.
hbrunie Jan 20, 2025
257aac7
#2828 class docstring and import sorted.
hbrunie Jan 20, 2025
9e41bcc
#2828 fix indent
hbrunie Jan 20, 2025
94be55c
#2828 remove __str__ method
hbrunie Jan 20, 2025
cf253a7
#2828 use new comment feature (thx JR)
hbrunie Jan 20, 2025
7bee936
#2828 comment each test
hbrunie Jan 20, 2025
463e64d
#2828 explicit warning message.
hbrunie Jan 20, 2025
4b61ea0
#2828 user friendly comment
hbrunie Jan 20, 2025
1e6089f
#2828 missing docstring
hbrunie Jan 20, 2025
880ce34
#2828 docstrings
hbrunie Jan 20, 2025
113565e
#2828 cover more edge cases.
hbrunie Jan 20, 2025
1a54922
#2828 remove outdated comment
hbrunie Jan 20, 2025
517682a
#2828 minor cleaning
hbrunie Jan 20, 2025
207cda3
#2828 fix sphinx make html
hbrunie Jan 20, 2025
b134774
#2828 fix flake8
hbrunie Jan 23, 2025
725b03d
#2828 introducing cls constant for test
hbrunie Jan 23, 2025
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
Prev Previous commit
Next Next commit
[ReplaceRefByLiteral] add test showing limit of trans
* Thanks Andrew, indeed, BinaryOp can be an valid initial_value
hbrunie committed Dec 17, 2024
commit b19b6a7e2843a1ad97a5956d45091527fa9e453f
Original file line number Diff line number Diff line change
@@ -233,11 +233,36 @@ def test_raise_transformation_error(fortran_reader, fortran_writer):
assert "Symbol already found" in error_str


def test_raise_transformation_error_initial_value_not_literal(
fortran_reader, fortran_writer
):
"""TODO: use sympy maybe to simplify expression before applying
transformation"""
source = """subroutine foo()
integer, parameter :: b = 3+2
integer :: x
x = b
end subroutine"""
psyir = fortran_reader.psyir_from_source(source)
foo: Routine = psyir.walk(Routine)[0]
assert foo.symbol_table is not None
from psyclone.psyir.symbols import DataSymbol

rbbl = ReplaceReferenceByLiteralTrans()
error_str = ""
try:
rbbl.apply(foo)
except TransformationError as e:
error_str = e.__str__()
assert "initial value is not a Literal" in error_str


def test_raise_transformation_error_initial_value(
fortran_reader, fortran_writer
):
source = """subroutine foo()
character(len=4), parameter :: a = "toto"
integer, parameter :: b = 3+2
character(len=4):: x
x = a
end subroutine"""