Skip to content
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

External function incorrectly detected as duplicate declaration #406

Open
albertziegenhagel opened this issue Jun 3, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@albertziegenhagel
Copy link
Contributor

albertziegenhagel commented Jun 3, 2024

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
image

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
@albertziegenhagel albertziegenhagel added the bug Something isn't working label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant