Skip to content

Conversation

@LonelyCat124
Copy link

No description provided.

@LonelyCat124
Copy link
Author

It seems somewhat tricky to solve, since I'm not sure how to determine if the comment is inline or not, I need to dive deeper into how this all works to understand it.

@sergisiso
Copy link
Collaborator

@LonelyCat124 Another thing to look at is that if we want to create unsupported directives in psyclone currently we should use a codeblock:

directive = Fortran2003.Directive("!DIR$ IVDEP")
cblock = CodeBlock([directive], CodeBlock.Structure.STATEMENT)

Currently this files in the backend because fparsernode.tofortran() for Fortran2003.Directive is not implemented. Even if we give better support in the future, I think we should implement the tofortran for each node.

@LonelyCat124
Copy link
Author

LonelyCat124 commented Nov 18, 2025

@LonelyCat124 Another thing to look at is that if we want to create unsupported directives in psyclone currently we should use a codeblock:

directive = Fortran2003.Directive("!DIR$ IVDEP")
cblock = CodeBlock([directive], CodeBlock.Structure.STATEMENT)

Currently this files in the backend because fparsernode.tofortran() for Fortran2003.Directive is not implemented. Even if we give better support in the future, I think we should implement the tofortran for each node.

I don't quite understand how/why this differs for the directives created via the frontend? I suspect they're created as CodeBlock.Structure.EXPRESSION?, since that just calls str(ast_node) which is implemented.
Edit: Nope, that also just makes a STATEMENT, so not sure why this breaks but the implemented version doesn't?

@LonelyCat124
Copy link
Author

Python 13.9 now throws an error for tests with this:

@pytest.fixture(autouse=True)
@pytest.mark.usefixtures("f2003_create")

This apparently didn't work before, so I'll remove the relevant mark.

@LonelyCat124
Copy link
Author

@sergisiso The base issue here is solved, I've not added the tofortran function as I'm a bit confused right now as to why this doesn't work for the manually created vs PSyclone created directives.

@LonelyCat124
Copy link
Author

LonelyCat124 commented Nov 21, 2025

@sergisiso - taken from teams:

Checking this Sergi's declaration of the CodeBlock maybe causes the issue? In the backend the get_ast_nodes call returns this:
<class 'NoneType'>

The directive = Fortran2003.Directive("string") is not the correct way to create one of these Directives, in fact I'm not sure its very easy to create one of these with how fparser creates these right now - it claims to take either str or FortranReaderBase as an input but at the moment it can only actually handle readFortran.Comment or FortranReaderBase as inputs

Do you want me to add the ability to make a Directive from a codesnippet directly?

Edit: Actually I'm not sure that would be so easy, I think it really might need the readfortran.Comment structure - maybe its easy to make a Comment from the string input?

Edit2: Not really - the creation of a readfortran.Comment still expects a FortranReaderBase input argument.

Copy link
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LonelyCat124 The functionality to prevent marking inlined comments as directives looks good but I am not sure about the removed fixture, see inline.

I am happy to move the Directive(string) to a separate issue.

@sergisiso sergisiso added reviewed with actions PR has been reviewed and is back with developer and removed under review labels Nov 24, 2025
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.19%. Comparing base (669e2b1) to head (59ee5e2).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #488   +/-   ##
=======================================
  Coverage   92.19%   92.19%           
=======================================
  Files          86       86           
  Lines       13802    13806    +4     
=======================================
+ Hits        12725    12729    +4     
  Misses       1077     1077           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LonelyCat124
Copy link
Author

@sergisiso I changed to your suggestion, and from reading the docs it should be ok so back to you.

@LonelyCat124 LonelyCat124 added ready for review and removed reviewed with actions PR has been reviewed and is back with developer labels Nov 25, 2025
Copy link
Collaborator

@sergisiso sergisiso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LonelyCat124 Everything looks good now. Ready to merge.

@sergisiso sergisiso merged commit 044f28d into master Nov 25, 2025
6 checks passed
@sergisiso sergisiso deleted the 483_inline_directives branch November 25, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants