Skip to content

Commit b0d125c

Browse files
committed
Fixes Use-directive ordering issue #7
Fixes Use-directive ordering issue #184
1 parent 058cb92 commit b0d125c

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
- Fixes Fortran line continuation definitions intermingled with preprocessor directives
4242
([#203](https://github.com/hansec/fortran-language-server/issues/203))
4343
([gnikit/fortls#4](https://github.com/gnikit/fortls/issues/4))
44+
- Fixes `USE` directive ordering issues
45+
([#184](https://github.com/hansec/fortran-language-server/issues/184))
46+
([gnikit/fortls#7](https://github.com/gnikit/fortls/issues/7))
4447

4548
## 1.16.0
4649

test/test_server.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def check_return(result_array):
195195
["test_str1", 13, 5],
196196
["test_str2", 13, 5],
197197
["test_sub", 6, 8],
198+
["test_use_ordering", 2, 9],
198199
["test_vis_mod", 2, 0],
199200
)
200201
assert len(result_array) == len(objs)
@@ -642,6 +643,11 @@ def check_return(results, ref_results):
642643
string += write_rpc_notification(
643644
"textDocument/didOpen", {"textDocument": {"uri": file_path}}
644645
)
646+
# Test USE directive ordering errors
647+
file_path = os.path.join(test_dir, "diag", "test_use_ordering.f90")
648+
string += write_rpc_notification(
649+
"textDocument/didOpen", {"textDocument": {"uri": file_path}}
650+
)
645651
errcode, results = run_request(string)
646652
assert errcode == 0
647653
file_path = os.path.join(test_dir, "diag", "test_external.f90")
@@ -693,6 +699,7 @@ def check_return(results, ref_results):
693699
},
694700
],
695701
[],
702+
[],
696703
]
697704
check_return(results[1:], ref_results)
698705

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module mod_a
2+
integer, parameter :: q_a = 4
3+
end module
4+
5+
module mod_b
6+
use mod_a
7+
integer, parameter :: q_b = 8
8+
end module
9+
10+
program test_use_ordering
11+
use mod_b, only: q_b
12+
use mod_a
13+
14+
real(q_a) :: r_a
15+
real(q_b) :: r_b
16+
end program test_use_ordering

0 commit comments

Comments
 (0)