Skip to content

Commit

Permalink
Fixes Use-directive ordering issue #7
Browse files Browse the repository at this point in the history
Fixes Use-directive ordering issue #184
  • Loading branch information
gnikit committed Jan 19, 2022
1 parent 058cb92 commit b0d125c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
- Fixes Fortran line continuation definitions intermingled with preprocessor directives
([#203](https://github.com/hansec/fortran-language-server/issues/203))
([gnikit/fortls#4](https://github.com/gnikit/fortls/issues/4))
- Fixes `USE` directive ordering issues
([#184](https://github.com/hansec/fortran-language-server/issues/184))
([gnikit/fortls#7](https://github.com/gnikit/fortls/issues/7))

## 1.16.0

Expand Down
7 changes: 7 additions & 0 deletions test/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def check_return(result_array):
["test_str1", 13, 5],
["test_str2", 13, 5],
["test_sub", 6, 8],
["test_use_ordering", 2, 9],
["test_vis_mod", 2, 0],
)
assert len(result_array) == len(objs)
Expand Down Expand Up @@ -642,6 +643,11 @@ def check_return(results, ref_results):
string += write_rpc_notification(
"textDocument/didOpen", {"textDocument": {"uri": file_path}}
)
# Test USE directive ordering errors
file_path = os.path.join(test_dir, "diag", "test_use_ordering.f90")
string += write_rpc_notification(
"textDocument/didOpen", {"textDocument": {"uri": file_path}}
)
errcode, results = run_request(string)
assert errcode == 0
file_path = os.path.join(test_dir, "diag", "test_external.f90")
Expand Down Expand Up @@ -693,6 +699,7 @@ def check_return(results, ref_results):
},
],
[],
[],
]
check_return(results[1:], ref_results)

Expand Down
16 changes: 16 additions & 0 deletions test/test_source/diag/test_use_ordering.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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_ordering
use mod_b, only: q_b
use mod_a

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

0 comments on commit b0d125c

Please sign in to comment.