1 ! RUN: %python %S/test_modfile.py %s %flang_fc1
5 procedure
, pass(x
) :: p1
=> f
6 procedure
, non_overridable
:: p2
=> f
7 procedure
, nopass
:: p3
=> f
8 generic
:: operator(+) => p1
9 generic
:: operator(-) => p2
10 generic
:: operator(<) => p1
11 generic
:: operator(.and
.) => p2
14 integer(8) pure
function f(x
, y
)
15 class(t1
), intent(in
) :: x
16 integer, intent(in
) :: y
18 ! Operators resolve to type-bound operators in t1
19 subroutine test1(x
, y
, a
, b
)
25 ! Operators resolve to type-bound operators in t1, compile-time resolvable
26 subroutine test2(x
, y
, a
, b
)
32 ! Operators resolve to type-bound operators in t1, compile-time resolvable
33 subroutine test3(x
, y
, a
)
43 ! procedure, pass(x) :: p1 => f
44 ! procedure, non_overridable :: p2 => f
45 ! procedure, nopass :: p3 => f
46 ! generic :: operator(+) => p1
47 ! generic :: operator(-) => p2
48 ! generic :: operator(<) => p1
49 ! generic :: operator(.and.) => p2
52 ! pure function f(x, y)
53 ! class(t1), intent(in) :: x
54 ! integer(4), intent(in) :: y
57 ! subroutine test1(x, y, a, b)
60 ! real(4) :: a(1_8:x%p1(y))
61 ! real(4) :: b(1_8:x%p1(y))
63 ! subroutine test2(x, y, a, b)
66 ! real(4) :: a(1_8:f(x, y))
67 ! real(4) :: b(1_8:f(x, y))
69 ! subroutine test3(x,y,a)
72 ! real(4) :: a(1_8:f(x,y))
79 procedure
, pass(x
) :: p1
=> f1
80 generic
:: operator(+) => p1
82 type, extends(t1
) :: t2
84 procedure
, pass(y
) :: p2
=> f2
85 generic
:: operator(+) => p2
88 integer(8) pure
function f1(x
, y
)
89 class(t1
), intent(in
) :: x
90 integer, intent(in
) :: y
92 integer(8) pure
function f2(x
, y
)
93 class(t1
), intent(in
) :: x
94 class(t2
), intent(in
) :: y
96 subroutine test1(x
, y
, a
)
101 ! Resolve to operator in parent class
102 subroutine test2(x
, y
, a
)
107 ! 2nd arg is passed object
108 subroutine test3(x
, y
, a
)
118 ! procedure, pass(x) :: p1 => f1
119 ! generic :: operator(+) => p1
121 ! type, extends(t1) :: t2
123 ! procedure, pass(y) :: p2 => f2
124 ! generic :: operator(+) => p2
127 ! pure function f1(x, y)
128 ! class(t1), intent(in) :: x
129 ! integer(4), intent(in) :: y
132 ! pure function f2(x, y)
133 ! class(t1), intent(in) :: x
134 ! class(t2), intent(in) :: y
137 ! subroutine test1(x, y, a)
140 ! real(4) :: a(1_8:x%p1(y))
142 ! subroutine test2(x, y, a)
145 ! real(4) :: a(1_8:x%p1(y))
147 ! subroutine test3(x, y, a)
150 ! real(4) :: a(1_8:y%p2(x))
157 procedure
, pass(x
) :: p1
=> f1
158 procedure
:: p3
=> f3
159 generic
:: operator(.binary
.) => p1
160 generic
:: operator(.unary
.) => p3
162 type, extends(t1
) :: t2
164 procedure
, pass(y
) :: p2
=> f2
165 generic
:: operator(.binary
.) => p2
168 integer(8) pure
function f1(x
, y
)
169 class(t1
), intent(in
) :: x
170 integer, intent(in
) :: y
172 integer(8) pure
function f2(x
, y
)
173 class(t1
), intent(in
) :: x
174 class(t2
), intent(in
) :: y
176 integer(8) pure
function f3(x
)
177 class(t1
), intent(in
) :: x
179 subroutine test1(x
, y
, a
)
182 real :: a(x
.binary
. y
)
184 ! Resolve to operator in parent class
185 subroutine test2(x
, y
, a
)
188 real :: a(x
.binary
. y
)
190 ! 2nd arg is passed object
191 subroutine test3(x
, y
, a
)
194 real :: a(x
.binary
. y
)
196 subroutine test4(x
, y
, a
)
199 real :: a(.unary
. x
+ .unary
. y
)
206 ! procedure,pass(x)::p1=>f1
208 ! generic::operator(.binary.)=>p1
209 ! generic::operator(.unary.)=>p3
211 ! type,extends(t1)::t2
213 ! procedure,pass(y)::p2=>f2
214 ! generic::operator(.binary.)=>p2
217 ! pure function f1(x,y)
218 ! class(t1),intent(in)::x
219 ! integer(4),intent(in)::y
222 ! pure function f2(x,y)
223 ! class(t1),intent(in)::x
224 ! class(t2),intent(in)::y
227 ! pure function f3(x)
228 ! class(t1),intent(in)::x
231 ! subroutine test1(x,y,a)
234 ! real(4)::a(1_8:x%p1(y))
236 ! subroutine test2(x,y,a)
239 ! real(4)::a(1_8:x%p1(y))
241 ! subroutine test3(x,y,a)
244 ! real(4)::a(1_8:y%p2(x))
246 ! subroutine test4(x,y,a)
249 ! real(4)::a(1_8:x%p3()+y%p3())