Skip to content

[BUG] kind keyword in variable declarations identified as not defined #175

Closed

Description

@gnikit

Is there an existing issue for this?

  • I have searched the existing issues

Description

When somewhere in a project one uses kind as a variable name, then in other places in variable declarations the kind keyword becomes underlined as an error: "object kind not found in scope" (as shown in the screenshot below).

Below is the code to reproduce the problem. if you rename the variable inside the program section from kind to kind_ the error highlighting inside the function disappears:

module test_module
    implicit none
    
contains

    function echo(num) result (res)
        implicit none
        ! the line below is treated as problematic, depending on the variable name inside the program test (if there is no variable named kind, no problem)
        integer (kind=4) :: res, num
        
        print *, num + 1 

        res = 0
    end function echo
    
end module test_module

program test
    use test_module
    implicit none
    ! try renaming kind to toggle behavior
    integer :: kind, res


    kind = 10
    res = echo(kind)

end program test

Screenshots

image

Expected Behaviour

Should not be reported as an error.

Version of Modern Fortran

v3.2.0

Version of Visual Studio Code

v1.69.2

Platform and Architecture

Linux

Additional Information

Linked to #173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions