1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test USE statements that use same module multiple times mixed with rename
3 ! clauses and ONLY clauses
32 use m1
,z
=>a
! This prevents the use association of m1's "a" as local "a"
33 use m2
! m2's version of "a" gets use associated
34 !ERROR: 'a' is use-associated from module 'm2' and cannot be re-declared
38 use m1
,only
: a
! This forces the use association of m1's "a" as local "a"
39 use m1
,z
=>a
! This rename doesn't affect the previous forced USE association
40 !ERROR: 'a' is use-associated from module 'm1' and cannot be re-declared
44 use m1
! By itself, this would use associate m1's "a" with a local "a"
45 use m1
,z
=>a
! This rename of m1'a "a" removes the previous use association
49 use m1
,only
: a
! Use associate m1's "a" with local "a"
50 use m1
,z
=>a
! Also use associate m1's "a" with local "z", also pulls in "b"
51 !ERROR: 'b' is use-associated from module 'm1' and cannot be re-declared
55 use m1
,z
=>a
! The rename prevents creation of a local "a"
56 use m1
! Does not create a local "a" because of the previous rename
60 use m1
, z
=> a
! Hides m1's "a"
61 use m1
, y
=> b
! Hides m1's "b"
66 use m3
,t1
=>t2
,t2
=>t1
! Looks weird but all is good
73 use m4
! This USE associates all of m1
74 !ERROR: 'a' is use-associated from module 'm4' and cannot be re-declared
83 use m4
, z
=>a
! This rename erases the USE assocated "a" from m1
88 use m6
, z
=>a
! This rename erases the USE assocated "a" from m1
92 use m4
! This USE associates "a" from m1
93 use m1
, z
=>a
! This renames the "a" from m1, but not the one through m4
94 !ERROR: 'a' is use-associated from module 'm4' and cannot be re-declared