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

Use-directive ordering issue #184

Open
mystery-e204 opened this issue Nov 19, 2020 · 2 comments
Open

Use-directive ordering issue #184

mystery-e204 opened this issue Nov 19, 2020 · 2 comments

Comments

@mystery-e204
Copy link

I have a situation like this:

module mod_a
   integer, parameter   :: q_a = 4
end module

module mod_b
   use mod_a
   integer, parameter   :: q_b = 8
end module

program test
   use mod_b,  only: q_b
   use mod_a

   real(q_a) :: r_a
   real(q_b) :: r_b
end program test

It compiles and runs fine but fortls states that q_a on line 14 cannot be found in the scope. The problem disappears if you swap the order of the use directives in the main program.

My guess is that because of the use mod_a on line 6, fortls does not parse mod_a a second time in the main program. However, since only q_b was included from mod_b, q_a never gets properly included.

@gnikit
Copy link

gnikit commented Jan 19, 2022

@manie204 BTW This has now been fixed at fortls. I just forgot to update the issue on github.

gnikit referenced this issue in fortran-lang/fortls Jan 19, 2022
Fixes Use-directive ordering issue #184
@mystery-e204
Copy link
Author

@gnikit Thanks for bringing this to my attention. I was unaware of your fork since I haven't been coding in Fortran for a while. I will check it out and also thanks for the fix.

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

No branches or pull requests

2 participants