Skip to content

Commit ff31b7e

Browse files
authored
Merge pull request #472 from fortran-lang/fix/diag-error-lowercase-interface-args
fix: diagnostic error for interface arguments
2 parents f7c3ecd + a7a2199 commit ff31b7e

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

fortls/parsers/internal/subroutine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def resolve_arg_link(self, obj_tree):
8686
# block's children i.e. functions and subroutines to see if one matches
8787
elif child.name.lower().startswith("#gen_int"):
8888
for sub_child in child.children:
89-
if arg == sub_child.name:
89+
if arg == sub_child.name.lower():
9090
self.arg_objs[i] = sub_child
9191
break
9292

test/test_server_diagnostics.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,18 @@ def test_critical_scope():
440440
errcode, results = run_request(string, ["-n", "1"])
441441
assert errcode == 0
442442
assert results[1]["diagnostics"] == []
443+
444+
445+
def test_mixed_case_interface_sub_child():
446+
"""
447+
Test that interface sub_child arguments are correctly resolved
448+
regardless of their case.
449+
"""
450+
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir / "diag")})
451+
file_path = str(test_dir / "diag" / "mixed_case_interface_sub_child.f90")
452+
string += write_rpc_notification(
453+
"textDocument/didOpen", {"textDocument": {"uri": file_path}}
454+
)
455+
errcode, results = run_request(string, ["-n", "1"])
456+
assert errcode == 0
457+
assert results[1]["diagnostics"] == []
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module mixed_case_interface_sub_child
2+
implicit none
3+
4+
contains
5+
subroutine foo(Func)
6+
interface
7+
function Func()
8+
end function Func
9+
end interface
10+
end subroutine foo
11+
end module mixed_case_interface_sub_child

0 commit comments

Comments
 (0)