Skip to content

fix: diagnostic error for interface arguments #472

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

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fortls/parsers/internal/subroutine.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def resolve_arg_link(self, obj_tree):
# block's children i.e. functions and subroutines to see if one matches
elif child.name.lower().startswith("#gen_int"):
for sub_child in child.children:
if arg == sub_child.name:
if arg == sub_child.name.lower():
self.arg_objs[i] = sub_child
break

Expand Down
15 changes: 15 additions & 0 deletions test/test_server_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,18 @@ def test_critical_scope():
errcode, results = run_request(string, ["-n", "1"])
assert errcode == 0
assert results[1]["diagnostics"] == []


def test_mixed_case_interface_sub_child():
"""
Test that interface sub_child arguments are correctly resolved
regardless of their case.
"""
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir / "diag")})
file_path = str(test_dir / "diag" / "mixed_case_interface_sub_child.f90")
string += write_rpc_notification(
"textDocument/didOpen", {"textDocument": {"uri": file_path}}
)
errcode, results = run_request(string, ["-n", "1"])
assert errcode == 0
assert results[1]["diagnostics"] == []
11 changes: 11 additions & 0 deletions test/test_source/diag/test_mixed_case_interface_sub_child.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module mixed_case_interface_sub_child
implicit none

contains
subroutine foo(Func)
interface
function Func()
end function Func
end interface
end subroutine foo
end module mixed_case_interface_sub_child