(Closes #1891) Catch implicit subroutine args and abort
A small PR that just tightens-up the fparser2 subroutine handler to make sure that we catch a subroutine that has arguments but no declarations. Since PSyclone does not support implicitly-declared data, we now raise an InternalError in this situation.
Codecov Report
Patch coverage: 100.00% and no project coverage change.
Comparison is base (
39e2f08) 99.84% compared to head (dc62c9a) 99.84%.
Additional details and impacted files
@@ Coverage Diff @@
## master #1914 +/- ##
=======================================
Coverage 99.84% 99.84%
=======================================
Files 311 311
Lines 42902 42920 +18
=======================================
+ Hits 42836 42854 +18
Misses 66 66
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/psyclone/tests/generator_test.py | 100.00% <ø> (ø) |
|
| src/psyclone/psyir/frontend/fparser2.py | 100.00% <100.00%> (ø) |
|
| ...psyir/frontend/fparser2_subroutine_handler_test.py | 100.00% <100.00%> (ø) |
|
| src/psyclone/tests/psyir/frontend/fparser2_test.py | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Small fix that just rearranges some of the code in the subroutine handler and checks for undeclared arguments early (to give a better error message than just a missing symbol). Ready for review from @sergisiso, @rupertford or @hiker :-)
I'm surprised the PSyIR allows this as (I think) it complains if local variables are known to be undeclared. Shouldn't the PSyIR reject undeclared arguments?
It doesn't allow this. Previously, if there were no variable declarations then we had a bug whereby the handler just didn't check whether there were any subroutine arguments. Now we always capture them and will raise an error if they don't exist in a symbol table. The additional check that I've added just allows for a more user-friendly error message by catching the problem earlier.
Ready for another look, subject to CI happiness.
@rupertford, would you mind taking a look at this one when you get the chance? It would be good to get it closed off.
Ready for another look now.