satamas / fortran-plugin

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

Using module within blocks marked as error #157

Open hippalectryon-0 opened 4 months ago

hippalectryon-0 commented 4 months ago

As indicated in https://fortran-lang.org/learn/quickstart/variables/, modules can be used inside BLOCK:

module your_module
    implicit none
    integer :: n = 2
end module

program main
    implicit none
    real :: x

    block
        use your_module, only: n ! you can import modules within blocks
        real :: y ! local scope variable
        y = 2.0
        x = y ** n
        print *, y
    end block
    ! print *, y ! this is not allowed as y only exists during the block's scope
    print *, x  ! prints 4.00000000
end program

However the linter marks that as an error.