wcc/check: #25 reject overlong array-lit in a tuple return (wwstage)

This commit is contained in:
2026-06-09 15:01:34 +09:00
parent 89f3e58458
commit f767819b41
4 changed files with 60 additions and 0 deletions

View File

@@ -25,6 +25,8 @@
* tuple_arr_over | let t:([2]int,i32)=([1,2,3],5) | b. FAIL
* tuple_nested_arr | let t:([2][3]int,i32)=([[..],[..],[..]],5) | b. FAIL
* tuple_in_tuple | let t:([2]int,([2]int,i32))=([..],([1,2,3],.))| #26 FAIL
* tuple_return_over | fn()([2]int,i32){return([1,2,3],5)} | #25 FAIL
* tuple_return_nested| fn()([2]int,([2]int,i32)){return(..,([..3],.))| #25 FAIL
*
* pos row | shape | want
* -------------------+----------------------------------------------+------
@@ -116,6 +118,25 @@ static const char *neg[] = {
"\tlet t: ([2]int, ([2]int, i32)) = ([1, 2], ([3, 4, 5], 6));\n"
"\treturn t.0[0]: i32;\n"
"};\n",
/* tuple_return_over (#25) — overlong [2]int in a tuple RETURN. */
"package main;\n"
"fn f() ([2]int, i32) = {\n"
"\treturn ([1, 2, 3], 5);\n"
"};\n"
"export fn main() i32 = {\n"
"\tlet t = f();\n"
"\treturn t.1;\n"
"};\n",
/* tuple_return_nested (#25 path × #26 recursion) — nested tuple in a
* RETURN, inner [2]int over-filled. */
"package main;\n"
"fn f() ([2]int, ([2]int, i32)) = {\n"
"\treturn ([1, 2], ([3, 4, 5], 6));\n"
"};\n"
"export fn main() i32 = {\n"
"\tlet t = f();\n"
"\treturn t.0[0]: i32;\n"
"};\n",
};
static int