119 lines · plain
1! RUN: %python %S/test_modfile.py %s %flang_fc12! Test resolution of type-bound generics.3 4module m15 type :: t6 contains7 procedure, pass(x) :: add1 => add8 procedure, nopass :: add2 => add9 procedure :: add_real10 generic :: g => add1, add2, add_real11 end type12contains13 integer(8) pure function add(x, y)14 class(t), intent(in) :: x, y15 end16 integer(8) pure function add_real(x, y)17 class(t), intent(in) :: x18 real, intent(in) :: y19 end20 subroutine test1(x, y, z)21 type(t) :: x, y22 real :: z(x%add1(y))23 end24 subroutine test1p(x, y, z)25 class(t) :: x, y26 real :: z(x%add1(y))27 end28 subroutine test2(x, y, z)29 type(t) :: x, y30 real :: z(x%g(y))31 end32 subroutine test2p(x, y, z)33 class(t) :: x, y34 real :: z(x%g(y))35 end36 subroutine test3(x, y, z)37 type(t) :: x, y38 real :: z(x%g(y, x))39 end40 subroutine test3p(x, y, z)41 class(t) :: x, y42 real :: z(x%g(y, x))43 end44 subroutine test4(x, y, z)45 type(t) :: x46 real :: y47 real :: z(x%g(y))48 end49 subroutine test4p(x, y, z)50 class(t) :: x51 real :: y52 real :: z(x%g(y))53 end54end55 56!Expect: m1.mod57!module m158! type :: t59! contains60! procedure, pass(x) :: add1 => add61! procedure, nopass :: add2 => add62! procedure :: add_real63! generic :: g => add164! generic :: g => add265! generic :: g => add_real66! end type67!contains68! pure function add(x, y)69! class(t), intent(in) :: x70! class(t), intent(in) :: y71! integer(8) :: add72! end73! pure function add_real(x, y)74! class(t), intent(in) :: x75! real(4), intent(in) :: y76! integer(8) :: add_real77! end78! subroutine test1(x, y, z)79! type(t) :: x80! type(t) :: y81! real(4) :: z(1_8:add(x, y))82! end83! subroutine test1p(x,y,z)84! class(t)::x85! class(t)::y86! real(4)::z(1_8:x%add1(y))87! end88! subroutine test2(x, y, z)89! type(t) :: x90! type(t) :: y91! real(4)::z(1_8:add(x,y))92! end93! subroutine test2p(x,y,z)94! class(t)::x95! class(t)::y96! real(4) :: z(1_8:x%add1(y))97! end98! subroutine test3(x, y, z)99! type(t) :: x100! type(t) :: y101! real(4)::z(1_8:add(y,x))102! end103! subroutine test3p(x,y,z)104! class(t)::x105! class(t)::y106! real(4) :: z(1_8:x%add2(y, x))107! end108! subroutine test4(x, y, z)109! type(t) :: x110! real(4) :: y111! real(4)::z(1_8:add_real(x,y))112! end113! subroutine test4p(x,y,z)114! class(t)::x115! real(4)::y116! real(4) :: z(1_8:x%add_real(y))117! end118!end119