Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / resolve32.f90
blob060b29ec40b5a464da3e0df969fb2e62548203ac
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 module m2
3 public s2, s4
4 private s3
5 contains
6 subroutine s2
7 end
8 subroutine s3
9 end
10 subroutine s4
11 end
12 end module
14 module m
15 use m2
16 external bar
17 interface
18 subroutine foo
19 end subroutine
20 end interface
21 integer :: i
22 type t1
23 integer :: c
24 contains
25 !ERROR: The binding of 'a' ('missing') must be either an accessible module procedure or an external procedure with an explicit interface
26 procedure, nopass :: a => missing
27 procedure, nopass :: b => s, s2
28 !ERROR: Type parameter, component, or procedure binding 'c' already defined in this type
29 procedure, nopass :: c
30 !ERROR: DEFERRED is only allowed when an interface-name is provided
31 procedure, nopass, deferred :: d => s
32 !Note: s3 not found because it's not accessible -- should we issue a message
33 !to that effect?
34 !ERROR: 's3' must be either an accessible module procedure or an external procedure with an explicit interface
35 procedure, nopass :: s3
36 procedure, nopass :: foo
37 !ERROR: 'bar' must be either an accessible module procedure or an external procedure with an explicit interface
38 procedure, nopass :: bar
39 !ERROR: 'i' must be either an accessible module procedure or an external procedure with an explicit interface
40 procedure, nopass :: i
41 !ERROR: Type parameter, component, or procedure binding 'b' already defined in this type
42 procedure, nopass :: b => s4
43 !ERROR: DEFERRED is required when an interface-name is provided
44 procedure(foo), nopass :: g
45 end type
46 type, abstract :: t1a ! DEFERRED valid only in ABSTRACT derived type
47 contains
48 procedure(foo), nopass, deferred :: e
49 procedure(s), nopass, deferred :: f
50 !ERROR: Type parameter, component, or procedure binding 'f' already defined in this type
51 procedure(foo), nopass, deferred :: f
52 !ERROR: 'bar' must be an abstract interface or a procedure with an explicit interface
53 procedure(bar), nopass, deferred :: h
54 end type
55 type t2
56 integer :: i
57 contains
58 procedure, nopass :: b => s
59 final :: f
60 !ERROR: FINAL subroutine 'i' of derived type 't2' must be a module procedure
61 final :: i
62 end type
63 type t3
64 contains
65 private
66 procedure, nopass :: b => s
67 procedure, nopass, public :: f
68 end type
69 contains
70 subroutine s
71 end
72 subroutine f(x)
73 type(t2) :: x
74 end
75 end module