mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 14:16:42 +00:00

A USE statement within a submodule (possibly in a nested scope) is not allowed to USE the submodule's ancestor module directly, but it is permissible to USE that ancestor module indirectly via another unrelated module. Don't emit "already present in scope" errors for this case. Fixes https://github.com/llvm/llvm-project/issues/124731.
27 lines
476 B
Fortran
27 lines
476 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
module m
|
|
interface
|
|
module subroutine separate
|
|
end
|
|
end interface
|
|
contains
|
|
subroutine modsub
|
|
!ERROR: Module 'm' cannot USE itself
|
|
use m
|
|
end
|
|
end
|
|
|
|
submodule(m) submod1
|
|
contains
|
|
module subroutine separate
|
|
!ERROR: Module 'm' cannot USE itself from its own submodule 'submod1'
|
|
use m
|
|
end
|
|
end
|
|
|
|
submodule(m) submod2
|
|
!ERROR: Module 'm' cannot USE itself from its own submodule 'submod2'
|
|
use m
|
|
end
|
|
|