From eaadec3ec64508f32364171878561860087ec85a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 5 Oct 2021 14:14:02 +0200 Subject: pkg/compiler: add more tests for templates Add 2 more tests for recursive templates. --- pkg/compiler/testdata/errors.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'pkg/compiler/testdata/errors.txt') diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index db653c180..2280d34b8 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -247,6 +247,9 @@ type type12 proc[123, 2, int16, opt] type type13 ptr[in, typestruct13] type type14 flags[type0, int32] type type15 const[0, type0] ### unexpected value type0 for base type argument of const type, expect [int8 int16 int32 int64 int16be int32be int64be intptr] +type type16 type17 ### type instantiation loop: type16 -> type16 +type type17 type18 ### unknown type type16 +type type18 type16 ### unknown type type16 type bool8 int8[0:1] ### type bool8 redeclared, previously declared as type alias at builtins typestruct11 { @@ -339,6 +342,23 @@ type TR[A, B] { } type TU TR[X, Y] +type TT1[A] { + f0 templ_base0[A] + f1 TT2[A] +} + +type TT2[A] { + f1 templ_base0[A] + f2 TT3[A] +} + +type TT3[A] { + f1 templ_base0[A] + f2 TT1[A] ### type instantiation loop: TT1[int8] -> TT2[int8] -> TT3[int8] -> TT1[int8] +} + +foo$213(a ptr[in, TT1[int8]]) + foo$glob001(a ptr[in, glob[1]]) ### unexpected int 1, string arg must be a string literal or string flags foo$glob002(a ptr[in, glob]) ### glob only accepts 1 arg, provided 0 foo$glob003(a ptr[in, glob["/sys", 5]]) ### glob only accepts 1 arg, provided 2 -- cgit mrf-deployment