hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
294 stars 57 forks source link

Return type of certain function declaration not parsed correctly #190

Open mystery-e204 opened 3 years ago

mystery-e204 commented 3 years ago

There is a case of function declaration that leads to the return type not being parsed correctly, namely:

integer function test(a) result(b)
   implicit none
   real :: a
   b = a
end function

Hover over a correctly shows real but hover over b does not reveal anything. It is the combination of the type in front of the function keyword with the result keyword at the end that causes this problem. Both

integer function test(a)
   implicit none
   real :: a
   test = a
end function

as well as

function test(a) result(b)
   implicit none
   integer :: b
   real :: a
   b = a
end function

parse and show the return type correctly.