1! RUN: %S/test_modfile.sh %s %f18 %t
2! Check modfile generation with use-association.
3
4module m1
5  integer :: x1
6  integer, private :: x2
7end
8!Expect: m1.mod
9!module m1
10!integer(4)::x1
11!integer(4),private::x2
12!end
13
14module m2
15  use m1
16  integer :: y1
17end
18!Expect: m2.mod
19!module m2
20!use m1,only:x1
21!integer(4)::y1
22!end
23
24module m3
25  use m2, z1 => x1
26end
27!Expect: m3.mod
28!module m3
29!use m2,only:y1
30!use m2,only:z1=>x1
31!end
32
33module m4
34  use m1
35  use m2
36end
37!Expect: m4.mod
38!module m4
39!use m1,only:x1
40!use m2,only:y1
41!end
42
43module m5a
44  integer, parameter :: k1 = 4
45  integer :: l1 = 2
46  type t1
47    real :: a
48  end type
49contains
50  pure integer function f1(i)
51    value :: i
52    f1 = i
53  end
54end
55!Expect: m5a.mod
56!module m5a
57! integer(4),parameter::k1=4_4
58! integer(4)::l1
59! type::t1
60!  real(4)::a
61! end type
62!contains
63! pure function f1(i)
64!  integer(4),value::i
65!  integer(4)::f1
66! end
67!end
68
69module m5b
70  use m5a, only: k2 => k1, l2 => l1, f2 => f1
71  character(l2, k2) :: x
72  interface
73    subroutine s(x, y)
74      import f2, l2
75      character(l2, k2) :: x
76      character(f2(l2)) :: y
77    end subroutine
78  end interface
79end
80!Expect: m5b.mod
81!module m5b
82! use m5a,only:k2=>k1
83! use m5a,only:l2=>l1
84! use m5a,only:f2=>f1
85! character(l2,4)::x
86! interface
87!  subroutine s(x,y)
88!   import::f2
89!   import::l2
90!   character(l2,4)::x
91!   character(f2(l2),1)::y
92!  end
93! end interface
94!end
95
96module m6a
97  type t1
98  end type
99end
100!Expect: m6a.mod
101!module m6a
102! type::t1
103! end type
104!end
105
106module m6b
107  use m6a, only: t2 => t1
108contains
109  subroutine s(x)
110    type(t2) :: x
111  end
112end
113!Expect: m6b.mod
114!module m6b
115! use m6a,only:t2=>t1
116!contains
117! subroutine s(x)
118!  type(t2)::x
119! end
120!end
121
122module m6c
123  use m6a, only: t2 => t1
124  type, extends(t2) :: t
125  end type
126end
127!Expect: m6c.mod
128!module m6c
129! use m6a,only:t2=>t1
130! type,extends(t2)::t
131! end type
132!end
133
134module m6d
135  use m6a, only: t2 => t1
136  type(t2), parameter :: p = t2()
137end
138!Expect: m6d.mod
139!module m6d
140! use m6a,only:t2=>t1
141! type(t2),parameter::p=t2()
142!end
143
144module m6e
145  use m6a, only: t2 => t1
146  interface
147    subroutine s(x)
148      import t2
149      type(t2) :: x
150    end subroutine
151  end interface
152end
153!Expect: m6e.mod
154!module m6e
155! use m6a,only:t2=>t1
156! interface
157!  subroutine s(x)
158!   import::t2
159!   type(t2)::x
160!  end
161! end interface
162!end
163