Skip to content

Use-directive ordering issue #184

Open
@mystery-e204

Description

@mystery-e204

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions