[flang-commits] [flang] 07b69dc - [flang] Response to Steve Scalpone's suggestion to improve a message

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Wed May 6 15:01:34 PDT 2020


Author: Pete Steinfeld
Date: 2020-05-06T15:00:53-07:00
New Revision: 07b69dcf66776a6a340c5b1b49ca8a36e712026d

URL: https://github.com/llvm/llvm-project/commit/07b69dcf66776a6a340c5b1b49ca8a36e712026d
DIFF: https://github.com/llvm/llvm-project/commit/07b69dcf66776a6a340c5b1b49ca8a36e712026d.diff

LOG: [flang] Response to Steve Scalpone's suggestion to improve a message

Summary: I updated the code that produces the message and the associated test.

Reviewers: sscalpone, DavidTruby, kiranchandramohan

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79514

Added: 
    

Modified: 
    flang/lib/Evaluate/check-expression.cpp
    flang/test/Semantics/resolve89.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/check-expression.cpp b/flang/lib/Evaluate/check-expression.cpp
index bf2432d11c3c..923e814fc59b 100644
--- a/flang/lib/Evaluate/check-expression.cpp
+++ b/flang/lib/Evaluate/check-expression.cpp
@@ -207,7 +207,7 @@ class CheckSpecificationExprHelper
       return std::nullopt;
     } else if (scope_.IsDerivedType() && IsVariableName(symbol) &&
         specExprContext_ == SpecificationExprContext::BOUND) { // C750
-      return "derived type component not allowed to reference to variable '"s +
+      return "derived type component not allowed to reference variable '"s +
           symbol.name().ToString() + "'";
     } else if (symbol.IsDummy()) {
       if (symbol.attrs().test(semantics::Attr::OPTIONAL)) {

diff  --git a/flang/test/Semantics/resolve89.f90 b/flang/test/Semantics/resolve89.f90
index 9583bfa3d9d7..93fc82c60310 100644
--- a/flang/test/Semantics/resolve89.f90
+++ b/flang/test/Semantics/resolve89.f90
@@ -58,7 +58,7 @@ subroutine s(iArg, allocArg, pointerArg, arrayArg, ioArg, optionalArg)
   real, dimension(iabs(iArg)) :: arrayVarWithIntrinsic
 
   type arrayType
-    !ERROR: Invalid specification expression: derived type component not allowed to reference to variable 'var'
+    !ERROR: Invalid specification expression: derived type component not allowed to reference variable 'var'
     real, dimension(var) :: varField
     !ERROR: Invalid specification expression: reference to impure function 'ivolatilestmtfunc'
     real, dimension(iVolatileStmtFunc()) :: arrayFieldWithVolatile
@@ -66,7 +66,7 @@ subroutine s(iArg, allocArg, pointerArg, arrayArg, ioArg, optionalArg)
     real, dimension(iImpureStmtFunc()) :: arrayFieldWithImpureFunction
     !ERROR: Invalid specification expression: reference to statement function 'ipurestmtfunc'
     real, dimension(iPureStmtFunc()) :: arrayFieldWithPureFunction
-    !ERROR: Invalid specification expression: derived type component not allowed to reference to variable 'iarg'
+    !ERROR: Invalid specification expression: derived type component not allowed to reference variable 'iarg'
     real, dimension(iabs(iArg)) :: arrayFieldWithIntrinsic
     !ERROR: Invalid specification expression: reference to intrinsic 'allocated' not allowed for derived type components
     real, dimension(merge(1, 2, allocated(allocArg))) :: realField1
@@ -74,7 +74,7 @@ subroutine s(iArg, allocArg, pointerArg, arrayArg, ioArg, optionalArg)
     real, dimension(merge(1, 2, associated(pointerArg))) :: realField2
     !ERROR: Invalid specification expression: non-constant reference to inquiry intrinsic 'is_contiguous' not allowed for derived type components
     real, dimension(merge(1, 2, is_contiguous(arrayArg))) :: realField3
-    !ERROR: Invalid specification expression: derived type component not allowed to reference to variable 'ioarg'
+    !ERROR: Invalid specification expression: derived type component not allowed to reference variable 'ioarg'
     real, dimension(ioArg) :: realField4
     !ERROR: Invalid specification expression: reference to intrinsic 'present' not allowed for derived type components
     real, dimension(merge(1, 2, present(optionalArg))) :: realField5


        


More information about the flang-commits mailing list