camfort / fortran-src

Fortran parsing and static analysis infrastructure
https://hackage.haskell.org/package/fortran-src
Other
48 stars 20 forks source link

refactor DoSpec to not use Statement #221

Open raehik opened 2 years ago

raehik commented 2 years ago

This removes Expression's mutual recursion with Statement.

raehik commented 2 years ago

I'm getting test failures related to the block analysis. uniplate behaviour has changed because with DoSpecs no longer storing a Statement, it doesn't get picked up by universeBi. I'm trying to convert DoSpecs to StExpressionAssigns to remove the need to rewrite the traversals or reconsider the AST, but it's not working.

raehik commented 2 years ago

I think it's due to analyseAllLhsVars. It won't work for DoSpecifications, I need to pass it a different processor that knows to turn them into assign statements.

raehik commented 2 years ago

Nope, same issue. I'm scratching my head at this - assuming there are more places where the missing StExpressionAssign causes uniplate to skip some do-related analysis

raehik commented 2 years ago

Another solution would be to change ExpImpliedDo instead. But DoSpecification shouldn't store a Statement, the only thing allowed in there is StExpressionAssign (which I've essentially expanded out).

raehik commented 2 years ago

The 5 failing tests are all related to DataFlow.reachingDefinitions, which calls allLhsVars, which were the problematic functions. Will spend a bit more time on this today... but if I can't solve it, I'll leave it for now.

raehik commented 2 years ago

bit lost, only 2 changes seem to have any impact on test results. Leaving for now.