jacobwilliams / json-fortran

A Modern Fortran JSON API
https://jacobwilliams.github.io/json-fortran/
Other
333 stars 82 forks source link

Fix jf_test_01 for NVHPC by removing unnecessary function in function #549

Closed EmilyBourne closed 3 months ago

EmilyBourne commented 6 months ago

As discussed in #531. Fix jf_test_01 with the NVHPC compiler by eliminating the function within a function.

jacobwilliams commented 3 months ago

note: jf_test_16 test is failing for some reason... looking into it.... see develop branch: https://github.com/jacobwilliams/json-fortran/actions/runs/9148368679/job/25150818128?pr=555

jacobwilliams commented 3 months ago

ah, I think I see why. in this new formulation without the internal function, there's no way for that internal call to json%traverse to update the finished argument. So I guess there was a reason it was like that. I'd need to think about how to make it work... it could be done using an internal wrapper function to call the traverse_callback, but then we are back to where we started with a function within a function?

EmilyBourne commented 3 months ago

ah, I think I see why. in this new formulation without the internal function, there's no way for that internal call to json%traverse to update the finished argument. So I guess there was a reason it was like that. I'd need to think about how to make it work... it could be done using an internal wrapper function to call the traverse_callback, but then we are back to where we started with a function within a function?

Ah I see what you mean. I agree we would either need a second function or a function in a function again. I have checked the status of the nvfortran compiler (24.3) and updated #531 . It seems that this test is no longer failing so maybe this PR can be closed anyway.