Ivan Zhechev 6c1ac141d3 [Flang] Ported test_errors.sh to Python
To enable Flang testing on Windows, shell scripts have to be ported to Python. In this patch the "test_errors.sh" script is ported to python ("test_errors.py"). The RUN line of existing tests was changed to make use of the python script.

Used python regex in place of awk/sed.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D107575
2021-09-06 08:19:42 +00:00

35 lines
866 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Ensures that things that aren't procedures aren't allowed to be called.
module m
integer :: i
integer, pointer :: ip
type :: t
end type
type :: pdt(k,len)
integer, kind :: k
integer, len :: len
end type
type(pdt(1,2)) :: x
namelist /nml/i
contains
subroutine s(d)
real d
!ERROR: 'm' is not a callable procedure
call m
!ERROR: Cannot call function 'i' like a subroutine
call i
!ERROR: Cannot call function 'ip' like a subroutine
call ip
!ERROR: 't' is not a callable procedure
call t
!ERROR: 'k' is not a procedure
call x%k
!ERROR: 'len' is not a procedure
call x%len
!ERROR: Use of 'nml' as a procedure conflicts with its declaration
call nml
!ERROR: Cannot call function 'd' like a subroutine
call d
end subroutine
end