1! RUN: %S/test_errors.sh %s %t %f18 2 3! case 1: ma_create_new_fun' was not declared a separate module procedure 4module m1 5 integer :: i 6 interface ma 7 module function ma_create_fun( ) result(this) 8 integer this 9 end function 10 end interface 11end module 12 13submodule (m1) ma_submodule 14 integer :: j 15 contains 16 module function ma_create_fun() result(this) 17 integer this 18 i = 1 19 j = 2 20 end function 21 22 !ERROR: 'ma_create_new_fun' was not declared a separate module procedure 23 module function ma_create_new_fun() result(this) 24 integer :: this 25 i = 2 26 j = 1 27 print *, "Hello" 28 end function 29end submodule 30 31! case 2: 'mb_create_new_sub' was not declared a separate module procedure 32module m2 33 integer :: i 34 interface mb 35 module subroutine mb_create_sub 36 end subroutine mb_create_sub 37 end interface 38end module 39 40submodule (m2) mb_submodule 41 integer :: j 42 contains 43 module subroutine mb_create_sub 44 integer this 45 i = 1 46 j = 2 47 end subroutine mb_create_sub 48 49 !ERROR: 'mb_create_new_sub' was not declared a separate module procedure 50 module SUBROUTINE mb_create_new_sub() 51 integer :: this 52 i = 2 53 j = 1 54 end SUBROUTINE mb_create_new_sub 55end submodule 56 57! case 3: separate module procedure without module prefix 58module m3 59 interface mc 60 function mc_create( ) result(this) 61 integer :: this 62 end function 63 end interface 64end module 65 66submodule (m3) mc_submodule 67 contains 68 !ERROR: 'mc_create' was not declared a separate module procedure 69 module function mc_create() result(this) 70 integer :: this 71 end function 72end submodule 73 74! case 4: Submodule having separate module procedure rather than a module 75module m4 76 interface 77 real module function func1() ! module procedure interface body for func1 78 end function 79 end interface 80end module 81 82submodule (m4) m4sub 83 interface 84 module function func2(b) ! module procedure interface body for func2 85 integer :: b 86 integer :: func2 87 end function 88 89 real module function func3() ! module procedure interface body for func3 90 end function 91 end interface 92 contains 93 real module function func1() ! implementation of func1 declared in m4 94 func1 = 20 95 end function 96end submodule 97 98submodule (m4:m4sub) m4sub2 99 contains 100 module function func2(b) ! implementation of func2 declared in m4sub 101 integer :: b 102 integer :: func2 103 func2 = b 104 end function 105 106 real module function func3() ! implementation of func3 declared in m4sub 107 func3 = 20 108 end function 109end submodule 110