xref: /llvm-project/flang/test/Semantics/team_number02.f90 (revision 4dc752e6ec095b7b005b231e5c65cefa349c1eee)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Check for semantic errors in team_number() function calls
3
4program team_number_tests
5  use iso_fortran_env, only : team_type
6  implicit none
7
8  type(team_type) home, league(2)
9  integer n, non_team_type
10  character non_integer
11
12  !___ standard-conforming statement with no optional arguments present ___
13  n = team_number()
14
15  !___ standard-conforming statements with team argument present ___
16  n = team_number(home)
17  n = team_number(team=home)
18  n = team_number(league(1))
19
20  !___ non-conforming statements ___
21  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'
22  n = team_number(non_team_type)
23
24  ! non-scalar team_type argument
25  !ERROR: 'team=' argument has unacceptable rank 1
26  n = team_number(team=league)
27
28  ! incorrectly typed argument
29  !ERROR: Actual argument for 'team=' has bad type 'REAL(4)'
30  n = team_number(3.4)
31
32  !ERROR: too many actual arguments for intrinsic 'team_number'
33  n = team_number(home, league(1))
34
35  !ERROR: repeated keyword argument to intrinsic 'team_number'
36  n = team_number(team=home, team=league(1))
37
38  ! keyword argument with incorrect type
39  !ERROR: Actual argument for 'team=' has bad type 'INTEGER(4)'
40  n = team_number(team=non_team_type)
41
42  ! incorrect keyword argument name but valid type
43  !ERROR: unknown keyword argument to intrinsic 'team_number'
44  n = team_number(my_team=home)
45
46  !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CHARACTER(KIND=1) and INTEGER(4)
47  non_integer = team_number(home)
48
49end program team_number_tests
50