Change how generic operators and assignments are checked for distinguishable procedures. Because of how they are invoked, available type-bound generics and normal generics all have to be considered together. This is different from how generic names are checked. Move common part of checking into DistinguishabilityHelper so that it can be used in both cases after the appropriate procedures have been added. Cache result of Procedure::Characterize(Symbol) in a map in CheckHelper so that we don't have to worry about passing the characterized Procedures around or the cost of recomputing them. Add MakeOpName() to construct names for defined operators and assignment for using in error messages. This eliminates the need for different messages in those cases. When the procedures for a defined operator or assignment are undistinguishable, include the type name in the error message, otherwise it may be ambiguous. Add missing check that procedures for defined operators are functions and that their dummy arguments are INTENT(IN) or VALUE. Differential Revision: https://reviews.llvm.org/D87341
40 lines
1.0 KiB
Bash
Executable File
40 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compile a source file and check errors against those listed in the file.
|
|
# Change the compiler by setting the F18 environment variable.
|
|
|
|
F18_OPTIONS="-fparse-only"
|
|
srcdir=$(dirname $0)
|
|
source $srcdir/common.sh
|
|
[[ ! -f $src ]] && die "File not found: $src"
|
|
|
|
log=$temp/log
|
|
actual=$temp/actual
|
|
expect=$temp/expect
|
|
diffs=$temp/diffs
|
|
|
|
cmd="$F18 $F18_OPTIONS $src"
|
|
( cd $temp; $cmd ) > $log 2>&1
|
|
if [[ $? -ge 128 ]]; then
|
|
cat $log
|
|
exit 1
|
|
fi
|
|
|
|
# $actual has errors from the compiler; $expect has them from !ERROR comments in source
|
|
# Format both as "<line>: <text>" so they can be diffed.
|
|
sed -n 's=^[^:]*:\([^:]*\):[^:]*: error: =\1: =p' $log > $actual
|
|
awk '
|
|
BEGIN { FS = "!ERROR: "; }
|
|
/^ *!ERROR: / { errors[nerrors++] = $2; next; }
|
|
{ for (i = 0; i < nerrors; ++i) printf "%d: %s\n", NR, errors[i]; nerrors = 0; }
|
|
' $src > $expect
|
|
|
|
if diff -U0 $actual $expect > $diffs; then
|
|
echo PASS
|
|
else
|
|
echo "$cmd"
|
|
< $diffs \
|
|
sed -n -e 's/^-\([0-9]\)/actual at \1/p' -e 's/^+\([0-9]\)/expect at \1/p' \
|
|
| sort -n -k 3
|
|
die FAIL
|
|
fi
|