Summary: Many of these were already implemented, and I just annotated the tests and/or the code. C752 was a simple check to verify that CONTIGUOUS components are arrays with C754 proved to be virtually identical to C750 that I implemented previously. This caused me to remove the distinction between specification expressions for type parameters and bounds expressions that I'd previously created. the POINTER attribute. I also changed the error messages to specify that errors in specification expressions could arise from either bad derived type components or type parameters. In cases where we detect a type param that was not declared, I created a symbol marked as erroneous. That avoids subsequent semantic process for expressions containing the symbol. This change caused me to adjust tests resolve33.f90 and resolve34.f90. Also, I avoided putting out error messages for erroneous type param symbols in `OkToAddComponent()` in resolve-names.cpp and in `EvaluateParameters()`, type.cpp. C756 checks that procedure components have the POINTER attribute. Reviewers: tskeith, klausler, DavidTruby Subscribers: llvm-commits Tags: #llvm, #flang Differential Revision: https://reviews.llvm.org/D79798
46 lines
1.4 KiB
Fortran
46 lines
1.4 KiB
Fortran
! RUN: %S/test_errors.sh %s %t %f18
|
|
! Derived type parameters
|
|
! C731 The same type-param-name shall not appear more than once in a given
|
|
! derived-type-stmt.
|
|
! C741 A type-param-name in a type-param-def-stmt in a derived-type-def shall
|
|
! be one of the type-paramnames in the derived-type-stmt of that
|
|
! derived-type-def.
|
|
! C742 Each type-param-name in the derived-type-stmt in a derived-type-def
|
|
! shall appear exactly once as a type-param-name in a type-param-def-stmt
|
|
! in that derived-type-def.
|
|
|
|
module m
|
|
!ERROR: Duplicate type parameter name: 'a'
|
|
type t1(a, b, a)
|
|
integer, kind :: a
|
|
integer(8), len :: b
|
|
end type
|
|
!ERROR: No definition found for type parameter 'b'
|
|
type t2(a, b, c)
|
|
integer, kind :: a
|
|
integer, len :: c
|
|
end type
|
|
!ERROR: No definition found for type parameter 'b'
|
|
type t3(a, b)
|
|
integer, kind :: a
|
|
integer :: b
|
|
end type
|
|
type t4(a)
|
|
integer, kind :: a
|
|
!ERROR: 'd' is not a type parameter of this derived type
|
|
integer(8), len :: d
|
|
end type
|
|
type t5(a, b)
|
|
integer, len :: a
|
|
integer, len :: b
|
|
!ERROR: Type parameter, component, or procedure binding 'a' already defined in this type
|
|
integer, len :: a
|
|
end type
|
|
!ERROR: No definition found for type parameter 'k'
|
|
!ERROR: No definition found for type parameter 'l'
|
|
type :: t6(k, l)
|
|
character(kind=k, len=l) :: d3
|
|
end type
|
|
type(t6(2, 10)) :: x3
|
|
end module
|