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

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

Closed
1 task done
gnikit opened this issue Jul 22, 2022 · 0 comments · Fixed by #238
Closed
1 task done

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

gnikit opened this issue Jul 22, 2022 · 0 comments · Fixed by #238
Assignees
Labels
bug Something isn't working

Comments

@gnikit
Copy link
Member

gnikit commented Jul 22, 2022

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
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant