1
+
2
+ ! ------------------------------------------------------------------------------
3
+ !
4
+ ! Tests the syntax highlighting of nested type select constructs is correct
5
+ !- ------------------------------------------------------------------------------
6
+
7
+ program select_type_test
8
+ implicit none
9
+
10
+
11
+ type :: point
12
+ real :: x, y
13
+ end type point
14
+
15
+ type, extends(point) :: point_3d
16
+ real :: z
17
+ end type point_3d
18
+
19
+ type, extends(point) :: color_point
20
+ integer :: color
21
+ end type color_point
22
+
23
+ type (point_3d), target :: p3
24
+ type (color_point), target :: c
25
+ class(point), pointer :: p_or_c
26
+ class(point), pointer :: p
27
+
28
+ p_or_c = > c
29
+ p = > p3
30
+ select type ( a = > p_or_c )
31
+ class is ( point )
32
+ ! "class ( point ) :: a" implied here
33
+ print * , a% x, a% y ! this block executes
34
+ select type (a)
35
+ type is (point_3d)
36
+ print * , " type(point_3d)"
37
+ type is (color_point)
38
+ print * , " type(color_point)"
39
+ class default
40
+ print * , " no matching type"
41
+ end select
42
+
43
+ class is (color_point) ! does not execute
44
+ select type (p)
45
+ class is (point_3d)
46
+ print * , " class(point_3d)"
47
+ class is (color_point)
48
+ print * , " class(color_point)"
49
+ class is (point)
50
+ print * , " class(point)"
51
+ class default
52
+ print * , " no matching class"
53
+ end select
54
+
55
+ type is ( point_3d ) ! does not execute
56
+ ! "type ( point_3d ) :: a" implied here
57
+ print * , a% x, a% y, a% z
58
+ class default
59
+ print * , " no matching class"
60
+ end select
61
+
62
+
63
+ end program select_type_test
0 commit comments