summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorarphaman <arphaman@gmail.com>2013-09-11 10:48:06 +0100
committerarphaman <arphaman@gmail.com>2013-09-11 10:48:06 +0100
commit084be7de21b6703e710860d98949c2009ae4e57c (patch)
tree4482bc44a9472eb2833195e93b7e517384260994 /test
parent4b8cec707df68b86cf35737fcc8f0e3898c19f69 (diff)
downloadflang-084be7de21b6703e710860d98949c2009ae4e57c.tar.gz
added parsing for structure components
Diffstat (limited to 'test')
-rw-r--r--test/Sema/type.f9514
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Sema/type.f95 b/test/Sema/type.f95
index de2160ab3a..d140df399a 100644
--- a/test/Sema/type.f95
+++ b/test/Sema/type.f95
@@ -1,4 +1,6 @@
! RUN: %flang -verify -fsyntax-only < %s
+! RUN: %flang -fsyntax-only -verify -ast-print %s 2>&1 | %file_check %s
+
PROGRAM typetest
INTEGER Bar ! expected-note {{previous definition is here}}
@@ -32,11 +34,13 @@ PROGRAM typetest
type(Point) p
type(Triangle) tri
integer i
+ character c
type(zzzzz) zvar ! expected-error {{use of undeclared identifier 'zzzzz'}}
type(Bar) barvar ! expected-error {{invalid type name 'bar'}}
p = Point(1.0, 2.0)
+ p = Point(0,1) ! CHECK: point(real(0), real(1))
p = i ! expected-error {{assigning to 'type point' from incompatible type 'integer'}}
i = p ! expected-error {{assigning to 'integer' from incompatible type 'type point'}}
@@ -48,4 +52,14 @@ PROGRAM typetest
p = Point(0.0, 1.0, 2.0) ! expected-error {{too many arguments to type constructor, expected 2, have 3}}
p = Point() ! expected-error {{too few arguments to type constructor, expected 2, have 0}}
+ i = p%x + p%y
+ p%x = 1.0
+ p%y = p%x
+ tri%vertices(1) = p
+ p = tri%vertices(1)
+ tri%vertices = Point(0,0)
+
+ i = p%z ! expected-error {{no member named 'z' in 'type point'}}
+ c = p%x ! expected-error {{assigning to 'character' from incompatible type 'real'}}
+
END PROGRAM typetest