aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/testdata/errors2.txt
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-05-10 18:02:54 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-05-14 19:28:01 +0200
commiteea28fee309680462752ef7709f1a94178dce44d (patch)
tree29caff3a1e370c092522a94a9a231d83a767d20b /pkg/compiler/testdata/errors2.txt
parent1886b2a4811a4d9adbfc509505a095848cc655eb (diff)
pkg/compiler: support complex len targets
This change adds compiler support for complex path expressions in len targets. E.g. it allows to refer to a sibling field as len[parent_struct:field:another_field]. See the docs change for details. This is just a compiler change. The feature is not yet supported by the prog package.
Diffstat (limited to 'pkg/compiler/testdata/errors2.txt')
-rw-r--r--pkg/compiler/testdata/errors2.txt34
1 files changed, 31 insertions, 3 deletions
diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt
index 77db29197..6b7737ef5 100644
--- a/pkg/compiler/testdata/errors2.txt
+++ b/pkg/compiler/testdata/errors2.txt
@@ -80,8 +80,8 @@ foo$sr0(a ptr[in, use_sr])
# Len target tests.
foo$100(a int32, b len[a])
-foo$101(a len[a]) ### len target a refer to itself
-foo$102(a ptr[in, len[a, int8]]) ### len target a refer to itself
+foo$101(a len[a]) ### len target a refers to itself
+foo$102(a ptr[in, len[a, int8]]) ### len target a refers to itself
foo$103(a int32, b len[c]) ### len target c does not exist
foo$104(a len[parent]) ### len target parent does not exist
foo$105(a ptr[in, int32], b ptr[in, array[len[a, int32]]])
@@ -109,6 +109,15 @@ s6 {
f2 array[int8]
} [size[10]] ### varlen struct s6 has size attribute
+s7 {
+ f1 int32
+ f2 u0
+}
+
+u0 [
+ f len[f1, int32] ### len target f1 does not exist
+]
+
u1 [
f1 ptr[in, array[int8]]
f2 len[f1, int32] ### len target f1 does not exist
@@ -124,7 +133,26 @@ u3 [
foo$200(a ptr[in, s2])
foo$201(a ptr[in, s1])
-foo$202(a u1)
+foo$202(a ptr[in, s7])
+foo$203(a u1)
+
+foo$204(a ptr[in, slen1])
+
+slen1 {
+ f0 len[parent, int32]
+ f1 len[parent:f0, int32] ### parent can't be part of path expressions
+ f2 len[slen21:a, int32] ### len target a does not exist
+ f3 len[f0:parent, int32] ### parent can't be part of path expressions
+ f4 len[slen2:f, int32] ### len path slen2 does not refer to a struct
+ f5 len[slen22:f, int32] ### len path slen22 does not refer to a struct
+ slen2 ptr[in, array[slen2]]
+ slen21 slen2
+ slen22 array[slen2]
+}
+
+slen2 {
+ f int32
+}
# Resource ctor tests.