xref: /llvm-project/flang/test/Semantics/modfile44.f90 (revision a3e9d3c2c7e9f8766bf03c63e43675258cc611ee)
1! RUN: %python %S/test_modfile.py %s %flang_fc1
2! Ensure that m2.mod explicitly USEs a generic interface from m1
3! so it can utilize its shadowed derived type.
4module m1
5  implicit none
6  type :: xyz
7    integer :: n
8  end type
9  interface xyz
10    module procedure xzy
11  end interface
12 contains
13  function xzy(j) result(res)
14    integer, intent(in) :: j
15    type(xyz) :: res
16    res%n = j
17  end function
18end module
19
20!Expect: m1.mod
21!module m1
22!type::xyz
23!integer(4)::n
24!end type
25!interface xyz
26!procedure::xzy
27!end interface
28!contains
29!function xzy(j) result(res)
30!integer(4),intent(in)::j
31!type(xyz)::res
32!end
33!end
34
35module m2
36  implicit none
37 contains
38  function foo(j) result(res)
39    use :: m1, only: xyz
40    integer, intent(in) :: j
41    type(xyz) :: res
42    res = xyz(j)
43  end function
44end module
45
46!Expect: m2.mod
47!module m2
48!contains
49!function foo(j) result(res)
50!use m1,only:xyz
51!integer(4),intent(in)::j
52!type(xyz)::res
53!end
54!end
55