fortls
fortls copied to clipboard
External function incorrectly detected as duplicate declaration
Describe the bug
When the same external function is declared in two separate subroutines, fortls
might report the second one as a duplicate declaration.
In the following code
subroutine foo
integer bar
external bar
end subroutine foo
subroutine foo2
integer bar
external bar
end subroutine foo2
fortls
reports an error (Variable "bar" declared twice in scope
) in the line external bar
in the foo2
subroutine (see the screenshot below).
To Reproduce
Given the code above in a file test_external_duplicates.f90
, executing
python -m fortls --debug_diagnostics --debug_filepath=test_external_duplicates.f90
gives
Testing "textDocument/publishDiagnostics" request:
File = "C:\source\fortls\test\test_source\diag\test_external_duplicates.f90"
================================================================================
Reported Diagnostics:
8:ERROR "Variable "bar" declared twice in scope"
================================================================================
Expected behavior I would expect that no error is being reported.
Screenshots & Animations
Setup information (please complete the following information):
- OS: Windows
- Python 3.11
- fortls 3.1.1.dev2+ge987ab6.d20240603
- VS Code
- Modern Fortran v3.4.2024051001