Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / resolve36.f90
blobbdb1b227f61cebaa0e2f24f53f09b3907b6af983
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 ! C1568 The procedure-name shall have been declared to be a separate module
4 ! procedure in the containing program unit or an ancestor of that program unit.
5 ! C1547 MODULE shall appear only in the function-stmt or subroutine-stmt of a
6 ! module subprogram or of a nonabstract interface body that is declared in the
7 ! scoping unit of a module or submodule.
8 module m1
9 interface
10 module subroutine sub1(arg1)
11 integer, intent(inout) :: arg1
12 end subroutine
13 module integer function fun1()
14 end function
15 end interface
16 type t
17 end type
18 integer i
19 end module
21 submodule(m1) s1
22 contains
23 !ERROR: 'missing1' was not declared a separate module procedure
24 module procedure missing1
25 end
26 !ERROR: 'missing2' was not declared a separate module procedure
27 module subroutine missing2
28 end
29 !ERROR: 't' was not declared a separate module procedure
30 module procedure t
31 end
32 !ERROR: 'i' was not declared a separate module procedure
33 module subroutine i
34 end
35 end submodule
37 module m2
38 interface
39 module subroutine sub1(arg1)
40 integer, intent(inout) :: arg1
41 end subroutine
42 module integer function fun1()
43 end function
44 end interface
45 type t
46 end type
47 !ERROR: Declaration of 'i' conflicts with its use as module procedure
48 integer i
49 contains
50 !ERROR: 'missing1' was not declared a separate module procedure
51 module procedure missing1
52 end
53 !ERROR: 'missing2' was not declared a separate module procedure
54 module subroutine missing2
55 end
56 !ERROR: 't' is already declared in this scoping unit
57 !ERROR: 't' was not declared a separate module procedure
58 module procedure t
59 end
60 !ERROR: 'i' was not declared a separate module procedure
61 module subroutine i
62 end
63 end module
65 ! Separate module procedure defined in same module as declared
66 module m3
67 interface
68 module subroutine sub
69 end subroutine
70 end interface
71 contains
72 module procedure sub
73 end procedure
74 end module
76 ! Separate module procedure defined in a submodule
77 module m4
78 interface
79 module subroutine a
80 end subroutine
81 module subroutine b
82 end subroutine
83 end interface
84 end module
85 submodule(m4) s4a
86 contains
87 module procedure a
88 end procedure
89 end submodule
90 submodule(m4:s4a) s4b
91 contains
92 module procedure b
93 end procedure
94 end
96 !ERROR: 'c1547' is a MODULE procedure which must be declared within a MODULE or SUBMODULE
97 real module function c1547()
98 func = 0.0
99 end function