[flang-commits] [PATCH] D125135: [flang] Reverse a reversed type compatibility check

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon May 9 18:00:41 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGeef76f9821b8: [flang] Reverse a reversed type compatibility check (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125135/new/

https://reviews.llvm.org/D125135

Files:
  flang/lib/Semantics/tools.cpp
  flang/test/Semantics/selecttype03.f90


Index: flang/test/Semantics/selecttype03.f90
===================================================================
--- flang/test/Semantics/selecttype03.f90
+++ flang/test/Semantics/selecttype03.f90
@@ -110,11 +110,16 @@
     if (i>0) then
       foo = array1(2,U)
     else if (i<0) then
-      !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CLASS(t1) and CLASS(t2)
-      foo = array2(2,U)
+      foo = array2(2,U) ! ok: t2 extends t1
     end if
   end function
 
+  function foo2()
+    class(t2),DIMENSION(:),allocatable :: foo2
+    !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CLASS(t2) and CLASS(t1)
+    foo2 = array1(2,:)
+  end function
+
   subroutine sub_with_in_and_inout_param(y, z)
     type(t2), INTENT(IN) :: y
     class(t2), INTENT(INOUT) :: z
Index: flang/lib/Semantics/tools.cpp
===================================================================
--- flang/lib/Semantics/tools.cpp
+++ flang/lib/Semantics/tools.cpp
@@ -94,7 +94,7 @@
 static bool MightBeSameDerivedType(
     const std::optional<evaluate::DynamicType> &lhsType,
     const std::optional<evaluate::DynamicType> &rhsType) {
-  return lhsType && rhsType && rhsType->IsTkCompatibleWith(*lhsType);
+  return lhsType && rhsType && lhsType->IsTkCompatibleWith(*rhsType);
 }
 
 Tristate IsDefinedAssignment(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125135.428252.patch
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220510/28111cb3/attachment-0001.bin>


More information about the flang-commits mailing list