A utility predicate in semantics was incorrectly determining that
an INTERFACE ASSIGNMENT(=) (or other form of generic) could not have
a specific procedure with an unlimited polymorphic second argument.
This led to a crash later in expression analysis. Fix, and
extend tests.
Differential Revision: https://reviews.llvm.org/D126151
if (!lhsType || !rhsType) {
return Tristate::No; // error or rhs is untyped
}
- if (lhsType->IsUnlimitedPolymorphic() || rhsType->IsUnlimitedPolymorphic()) {
+ if (lhsType->IsUnlimitedPolymorphic()) {
return Tristate::No;
}
+ if (rhsType->IsUnlimitedPolymorphic()) {
+ return Tristate::Maybe;
+ }
TypeCategory lhsCat{lhsType->category()};
TypeCategory rhsCat{rhsType->category()};
if (rhsRank > 0 && lhsRank != rhsRank) {
class(t), intent(out) :: x
integer, intent(in) :: y
end
+ subroutine s2(x, y)
+ real, intent(out) :: x
+ class(*), intent(in) :: y
+ end
end interface
interface operator(+)
integer function f(x, y)
end
end interface
contains
- subroutine test(x, y)
+ subroutine test(x, y, z)
class(t) :: x, y
+ class(*), intent(in) :: z
+ real :: a
!CHECK: CALL s1(x,2_4)
x = 2
!CHECK: i=f(x,y)
i = x + y
+ !CHECK: CALL s2(a,z)
+ a = z
end
end
-