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

Fortran famously allows a generic interface definition to share a scope with a procedure or derived type of the same name. When that shadowed name is accessed via host or USE association, but is also defined by an interface in the generic, then name resolution needs to fix up the representation of the shadowing so that the new interface definition is seen as the shadowed symbol -- the host or USE associated name is not material to the situation. See the new test case for particular examples. Differential Revision: https://reviews.llvm.org/D136891
80 lines
1.3 KiB
Fortran
80 lines
1.3 KiB
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Ensures that a generic's shadowed procedure or derived type
|
|
! can be overridden by a valid interior interface definition
|
|
! in some cases.
|
|
|
|
module m1
|
|
contains
|
|
subroutine foo
|
|
end subroutine
|
|
subroutine test
|
|
interface foo
|
|
subroutine foo(n)
|
|
integer, intent(in) :: n
|
|
end subroutine
|
|
end interface
|
|
call foo(1)
|
|
end subroutine
|
|
end module
|
|
|
|
module m2
|
|
contains
|
|
subroutine test
|
|
interface foo
|
|
subroutine foo(n)
|
|
integer, intent(in) :: n
|
|
end subroutine
|
|
end interface
|
|
call foo(1)
|
|
end subroutine
|
|
subroutine foo
|
|
end subroutine
|
|
end module
|
|
|
|
module m3
|
|
interface
|
|
subroutine foo
|
|
end subroutine
|
|
end interface
|
|
contains
|
|
subroutine test
|
|
interface foo
|
|
subroutine foo(n)
|
|
integer, intent(in) :: n
|
|
end subroutine
|
|
end interface
|
|
call foo(1)
|
|
end subroutine
|
|
end module
|
|
|
|
module m4a
|
|
contains
|
|
subroutine foo
|
|
end subroutine
|
|
end module
|
|
module m4b
|
|
use m4a
|
|
contains
|
|
subroutine test
|
|
interface foo
|
|
subroutine foo(n)
|
|
integer, intent(in) :: n
|
|
end subroutine
|
|
end interface
|
|
call foo(1)
|
|
end subroutine
|
|
end module
|
|
|
|
module m5
|
|
type bar
|
|
end type
|
|
contains
|
|
subroutine test
|
|
interface bar
|
|
real function bar()
|
|
end function
|
|
end interface
|
|
print *, bar()
|
|
end subroutine
|
|
end module
|