xref: /llvm-project/flang/test/Semantics/resolve21.f90 (revision aace1e1719a1610ce9fa93c7dae38a4272d7b6bf)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2subroutine s1
3  type :: t
4    integer :: i
5    integer :: s1
6    integer :: t
7  end type
8  !ERROR: 't' is already declared in this scoping unit
9  integer :: t
10  integer :: i, j
11  type(t) :: x
12  !ERROR: Derived type 't2' not found
13  type(t2) :: y
14  external :: v
15  type(t) :: v, w
16  external :: w
17  !ERROR: 'z' is not an object of derived type; it is implicitly typed
18  i = z%i
19  !ERROR: 's1' is not an object and may not be used as the base of a component reference or type parameter inquiry
20  i = s1%i
21  !ERROR: 'j' is not an object of derived type
22  i = j%i
23  !ERROR: Component 'j' not found in derived type 't'
24  i = x%j
25  !ERROR: 'v' is not an object and may not be used as the base of a component reference or type parameter inquiry
26  i = v%i
27  !ERROR: 'w' is not an object and may not be used as the base of a component reference or type parameter inquiry
28  i = w%i
29  i = x%i  !OK
30end subroutine
31
32subroutine s2
33  type :: t1
34    integer :: i
35  end type
36  type :: t2
37    type(t1) :: x
38  end type
39  type(t2) :: y
40  integer :: i
41  !ERROR: Component 'j' not found in derived type 't1'
42  k = y%x%j
43  k = y%x%i !OK
44end subroutine
45