[LLVM] Fix Maintainers.md formatting (NFC)
[llvm-project.git] / flang / test / Semantics / generic07.f90
blobe7486c02a7d2ba1c5d122c354910cee82e5a1aca
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 module m1
3 type :: t1
4 sequence
5 real :: x
6 end type
7 type :: t2
8 sequence
9 real :: x
10 end type
11 type :: t3
12 real :: x
13 end type
14 type :: t4
15 real, private :: x
16 end type
17 contains
18 subroutine s1a(x)
19 type(t1), intent(in) :: x
20 end
21 subroutine s2a(x)
22 type(t2), intent(in) :: x
23 end
24 subroutine s3a(x)
25 type(t3), intent(in) :: x
26 end
27 subroutine s4a(x)
28 type(t4), intent(in) :: x
29 end
30 end
32 module m2
33 type t10
34 integer n
35 contains
36 procedure :: f
37 generic:: operator(+) => f
38 end type
39 contains
40 elemental type(t10) function f(x,y)
41 class(t10), intent(in) :: x, y
42 f%n = x%n + y%n
43 end
44 end
46 module m3
47 use m2, only: rt10 => t10
48 end
50 program test
51 use m1, only: s1a, s2a, s3a, s4a
52 use m2, only: t10
53 use m3, only: rt10 ! alias for t10, ensure no distinguishability error
54 type :: t1
55 sequence
56 integer :: x ! distinct type
57 end type
58 type :: t2
59 sequence
60 real :: x
61 end type
62 type :: t3 ! no SEQUENCE
63 real :: x
64 end type
65 type :: t4
66 real :: x ! not PRIVATE
67 end type
68 interface distinguishable1
69 procedure :: s1a, s1b
70 end interface
71 interface distinguishable2
72 procedure :: s1a, s1b
73 end interface
74 interface distinguishable3
75 procedure :: s1a, s1b
76 end interface
77 !ERROR: Generic 'indistinguishable' may not have specific procedures 's2b' and 's2a' as their interfaces are not distinguishable
78 interface indistinguishable
79 procedure :: s2a, s2b
80 end interface
81 contains
82 subroutine s1b(x)
83 type(t1), intent(in) :: x
84 end
85 subroutine s2b(x)
86 type(t2), intent(in) :: x
87 end
88 subroutine s3b(x)
89 type(t3), intent(in) :: x
90 end
91 subroutine s4b(x)
92 type(t4), intent(in) :: x
93 end
94 end