satamas / fortran-plugin

Fortran language plugin for IntelliJ Idea
Apache License 2.0
80 stars 18 forks source link

Plugin fails when using overload interface #95

Open LecrisUT opened 1 year ago

LecrisUT commented 1 year ago

Issue

When using overload inteface, e.g.

    interface my_func
        module procedure my_funca
        module procedure my_funcb
    end interface my_func

the plugin completely freaks out and cannot locate any other subroutine/interfaces, e.g. cannot jump to any other interface (although can jump to the the main overload interface)

Minimum working example

MWE ```fortran module my_mod implicit none private public :: my_func, my_funca, my_funcb, test interface my_func module procedure my_funca module procedure my_funcb end interface my_func interface module subroutine my_funca(a) integer, intent(in) :: a end subroutine my_funca module subroutine my_funcb(a) real, intent(in) :: a end subroutine my_funcb module subroutine test() end subroutine test end interface contains module procedure my_funca print *, 'Debug message' end procedure my_funca module procedure my_funcb print *, 'Debug message' end procedure my_funcb module procedure test print *, 'Debug message' end procedure test end module my_mod program mwe_fortran_interface use my_mod implicit none integer a real b call my_funca(a) call my_funcb(b) call my_func(a) call my_func(b) call test() end program ``` Here I cannot navigate to `test`, `my_funca` or `my_funcb`. What works is `my_func` though.

Related to: #66

LecrisUT commented 1 year ago

Well navigating this plugin's code is quite challenging. At least I've found a difference when I use interface my_func or not. https://github.com/satamas/fortran-plugin/blob/bf11abd683cd32ec794945d7cd044962ecf0b54d/src/main/kotlin/org/jetbrains/fortran/ide/findUsages/FortranFindUsagesHandlerFactory.kt#L20-L23 When it works correctly the element is detected as FortranEntityDecl, but with interface my_func it becomes FortranDataPath