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

Statement function fix #214

Closed
wants to merge 4 commits into from

Conversation

mlange05
Copy link

While statement functions are already implemented in fparser.two.Fortran2003.py, they are not recognised in the declaration-construct of subroutines. This PR fixes this and adds a small set of tests. With the test in place, issue #202 has probably been addressed?

@mlange05
Copy link
Author

Oh snap, I just realised that a statement function test exists in subroutines, and that the issue goes a little deeper. Apologies! Will take a look how to address C1112:

C1112: Test an exception is raised if a statement-function statement is specified in a submodule.

It seems a solution to this has existed before? <confused>
@codecov-io
Copy link

codecov-io commented Oct 18, 2019

Codecov Report

Merging #214 into master will increase coverage by 0.17%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #214      +/-   ##
==========================================
+ Coverage   89.71%   89.89%   +0.17%     
==========================================
  Files          34       34              
  Lines       11929    11930       +1     
==========================================
+ Hits        10702    10724      +22     
+ Misses       1227     1206      -21
Impacted Files Coverage Δ
src/fparser/two/Fortran2003.py 92.46% <ø> (+0.38%) ⬆️
src/fparser/two/Fortran2008.py 100% <100%> (ø) ⬆️
src/fparser/common/readfortran.py 91.62% <0%> (+0.14%) ⬆️
src/fparser/common/base_classes.py 68.98% <0%> (+0.16%) ⬆️
src/fparser/common/splitline.py 100% <0%> (+0.63%) ⬆️
src/fparser/common/sourceinfo.py 100% <0%> (+0.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94939a5...f544a7a. Read the comment docs.

@mlange05
Copy link
Author

Ok, so re-enabling the existing fix/workaround for statement functions seems to bring the tests back to green. Since neither #202 nor the comments in the code specified why that was disabled in the first place, I'd be very interested to see what the concerns were and if I can help find a better solution for this. Happy to help and do some legwork, as it's an unfortunately strong requirement for my downstream stuff.

Basically, without knowing the exact limits of the specification and
execution parts of a subroutine, a statement function looks like an
array access to the frontend and aliased. This new test checks that
the distinction is made correctly, and that a stmt function in the
execution part fails.
@mlange05
Copy link
Author

@rupertford After off-line discussion, I think I understand what the issues are. I've added a test case to demonstrate the aliasing issue with array assignment statements across the divide between specification and execution part of a subroutine. More work needed to get around this though...

@rupertford
Copy link
Collaborator

Hi @mlange05. Given our discussion at ECMWF and the newly updated descriptions of #202 and #201 (which suggest we create a symbol table before trying to tackle determining whether this is a statement function or not i.e. get more contextual information than just the rule itself), would it make sense for this PR to be changed into simply adding an appropriate xfailing test, or do you want to keep it open ready for personal use and to wait for the completion of #201?

@mlange05
Copy link
Author

mlange05 commented Nov 6, 2019

@rupertford Yeah, I think I'll keep the branch for reference but simply close the PR for now. I'll bring it back once we have the symbol table in place. I'll try and find some time to look at this soon. 🤞

@mlange05 mlange05 closed this Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants