fortran-language-server icon indicating copy to clipboard operation
fortran-language-server copied to clipboard

Renamed procedure in use statment not recognized

Open mystery-e204 opened this issue 6 years ago • 2 comments

When renaming an external/module procedure name in the local namespace via "use", it is not recognized by Intellisense. In issue #109, this problem was already addressed for the case of variable names.

Here is a MWE of a potentially tricky case:

module test_module
   implicit none
   
   contains

   function func_1(x) result(out)
      integer              :: out
      integer, intent(in)  :: x
      out = x + 1
   end function
end module test_module

program test
   use test_module, func_1_ref => func_1
   implicit none

   logical  :: func_1
   func_1 = .true.

   write(*, *) func_1
   write(*, *) func_1_ref(3)
end program test

In the main program's scope, func_1 is a valid variable name that is correctly recognized as logical by Intellisense. However, in the line containing the use statement, func_1 is incorrectly identified as a logical variable as well. As stated above, func_1_ref is not recognized.

mystery-e204 avatar Sep 02 '19 09:09 mystery-e204

Sorry about the delay and thanks for the report. In the current version 1.10.3 I am not able to fully reproduce your bug. In particular, func_1_ref seems to be recognized as expected. I do see the issue with func_1 on the USE line. Can you verify you still see the buggy behavior?

hansec avatar Dec 27 '19 21:12 hansec

Sorry, I was absent for a few days myself. That is odd. I copied the MWE I posted above into a fresh editor window and still see the same behavior. All extension are up-to-date and fortls shows version 1.10.3 on python3.7.3. The only non-default option I have set is variableHover but that doesn't change the outcome.

My VSCode version info: Version: 1.41.1 Commit: 26076a4de974ead31f97692a0d32f90d735645c0 Date: 2019-12-18T15:04:31.999Z Electron: 6.1.5 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Linux x64 4.15.0-65-generic

mystery-e204 avatar Jan 07 '20 09:01 mystery-e204