|
| 1 | +! RUN: %python %S/test_errors.py %s %flang_fc1 |
| 2 | +! Check for semantic errors in num_images() function calls |
| 3 | + |
| 4 | +program num_images_with_team_type |
| 5 | + use iso_fortran_env, only : team_type |
| 6 | + implicit none |
| 7 | + |
| 8 | + type(team_type) home, league(2) |
| 9 | + integer n |
| 10 | + integer :: standard_initial_value = -1 |
| 11 | + integer coindexed[*] |
| 12 | + integer array(1) |
| 13 | + |
| 14 | + !___ standard-conforming statement with no optional arguments present ___ |
| 15 | + n = num_images() |
| 16 | + |
| 17 | + !___ standard-conforming statements with team_number argument present ___ |
| 18 | + n = num_images(-1) |
| 19 | + n = num_images(team_number = -1) |
| 20 | + n = num_images(team_number = standard_initial_value) |
| 21 | + n = num_images(standard_initial_value) |
| 22 | + n = num_images(coindexed[1]) |
| 23 | + |
| 24 | + !___ standard-conforming statements with team_type argument present (not yet supported) ___ |
| 25 | + |
| 26 | + !ERROR: too many actual arguments for intrinsic 'num_images' |
| 27 | + n = num_images(home) |
| 28 | + |
| 29 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 30 | + n = num_images(team=home) |
| 31 | + |
| 32 | + !___ non-conforming statements ___ |
| 33 | + |
| 34 | + ! non-scalar integer argument |
| 35 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 36 | + n = num_images(team_number=array) |
| 37 | + |
| 38 | + ! non-scalar team_type argument |
| 39 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 40 | + n = num_images(team=league) |
| 41 | + |
| 42 | + ! incorrectly typed argument |
| 43 | + !ERROR: too many actual arguments for intrinsic 'num_images' |
| 44 | + n = num_images(3.4) |
| 45 | + |
| 46 | + !ERROR: too many actual arguments for intrinsic 'num_images' |
| 47 | + n = num_images(1, -1) |
| 48 | + |
| 49 | + !ERROR: too many actual arguments for intrinsic 'num_images' |
| 50 | + n = num_images(home, standard_initial_value) |
| 51 | + |
| 52 | + ! keyword argument with incorrect type |
| 53 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 54 | + n = num_images(team_number=1.1) |
| 55 | + |
| 56 | + ! incorrect keyword argument name but valid type (type number) |
| 57 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 58 | + n = num_images(team_num=-1) |
| 59 | + |
| 60 | + ! incorrect keyword argument name but valid type (team_type) |
| 61 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 62 | + n = num_images(my_team=home) |
| 63 | + |
| 64 | + ! correct keyword argument name but mismatched type |
| 65 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 66 | + n = num_images(team=-1) |
| 67 | + |
| 68 | + ! correct keyword argument name but mismatched type |
| 69 | + !ERROR: unknown keyword argument to intrinsic 'num_images' |
| 70 | + n = num_images(team_number=home) |
| 71 | + |
| 72 | +end program num_images_with_team_type |
0 commit comments