xref: /llvm-project/flang/test/Semantics/resolve86.f90 (revision 6c1ac141d3c98af9738bc77fcb55602cbff7751f)
1*6c1ac141SIvan Zhechev! RUN: %python %S/test_errors.py %s %flang_fc1
22b790490SPete Steinfeld! C736 If EXTENDS appears and the type being defined has a coarray ultimate
32b790490SPete Steinfeld! component, its parent type shall have a coarray ultimate component.
42b790490SPete Steinfeld!
52b790490SPete Steinfeldsubroutine s()
62b790490SPete Steinfeld  type coarrayParent
72b790490SPete Steinfeld    real,allocatable, codimension[:] :: parentField
82b790490SPete Steinfeld  end type coarrayParent
92b790490SPete Steinfeld
102b790490SPete Steinfeld  type, extends(coarrayParent) :: goodChildType
112b790490SPete Steinfeld    real, allocatable, codimension[:] :: childField
122b790490SPete Steinfeld  end type goodChildType
132b790490SPete Steinfeld
142b790490SPete Steinfeld  type, extends(coarrayParent) :: brotherType
152b790490SPete Steinfeld    real :: brotherField
162b790490SPete Steinfeld  end type brotherType
172b790490SPete Steinfeld
182b790490SPete Steinfeld  type, extends(brotherType) :: grandChildType
192b790490SPete Steinfeld    real, allocatable, codimension[:] :: grandChildField
202b790490SPete Steinfeld  end type grandChildType
212b790490SPete Steinfeld
222b790490SPete Steinfeld  type plainParent
232b790490SPete Steinfeld  end type plainParent
242b790490SPete Steinfeld
252b790490SPete Steinfeld  !ERROR: Type 'badchildtype' has a coarray ultimate component so the type at the base of its type extension chain ('plainparent') must be a type that has a coarray ultimate component
262b790490SPete Steinfeld  type, extends(plainParent) :: badChildType
272b790490SPete Steinfeld    real, allocatable, codimension[:] :: childField
282b790490SPete Steinfeld  end type badChildType
292b790490SPete Steinfeld
302b790490SPete Steinfeld  type, extends(plainParent) :: plainChild
312b790490SPete Steinfeld    real :: realField
322b790490SPete Steinfeld  end type plainChild
332b790490SPete Steinfeld
342b790490SPete Steinfeld  !ERROR: Type 'badchildtype2' has a coarray ultimate component so the type at the base of its type extension chain ('plainparent') must be a type that has a coarray ultimate component
352b790490SPete Steinfeld  type, extends(plainChild) :: badChildType2
362b790490SPete Steinfeld    real, allocatable, codimension[:] :: childField
372b790490SPete Steinfeld  end type badChildType2
382b790490SPete Steinfeld
392b790490SPete Steinfeld  !ERROR: Type 'badchildtype3' has a coarray ultimate component so the type at the base of its type extension chain ('plainparent') must be a type that has a coarray ultimate component
402b790490SPete Steinfeld  type, extends(plainParent) :: badChildType3
412b790490SPete Steinfeld    type(coarrayParent) :: childField
422b790490SPete Steinfeld  end type badChildType3
432b790490SPete Steinfeld
442b790490SPete Steinfeldend subroutine s
45