test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: field 'bogus' not found on type 'Vec'
|
||||
--> examples/diagnostics/1100-diagnostics-err-field-not-found.sx:8:15
|
||||
|
|
||||
8 | return xx v.bogus;
|
||||
| ^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: field '42' not found on type 'tuple'
|
||||
--> examples/diagnostics/1101-diagnostics-err-tuple-oob.sx:6:15
|
||||
|
|
||||
6 | return xx t.42;
|
||||
| ^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: cannot infer enum type for '.Foo' — use an explicit type or assign to a typed variable
|
||||
--> examples/diagnostics/1102-diagnostics-err-dot-shorthand.sx:5:10
|
||||
|
|
||||
5 | x := .Foo(1, 2);
|
||||
| ^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: no variant 'Bogus' on type 'Shape'
|
||||
--> examples/diagnostics/1103-diagnostics-err-bad-variant.sx:18:14
|
||||
|
|
||||
18 | case .Bogus: (x) { print("bogus={}\n", x); }
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: call-convention mismatch: 'sx_handler' is declared with default sx convention but the target type expects abi(.c)
|
||||
--> examples/diagnostics/1104-diagnostics-callconv-mismatch-diagnostic.sx:12:37
|
||||
|
|
||||
12 | fp : (*void) -> *void abi(.c) = sx_handler;
|
||||
| ^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: intentional compile error from #run
|
||||
--> examples/diagnostics/1105-diagnostics-compile-error.sx:12:6
|
||||
|
|
||||
12 | #run compile_error("intentional compile error from #run");
|
||||
| ^^^^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,29 @@
|
||||
error: cannot apply '+' to operands of type 'i64' and 'string'
|
||||
--> examples/diagnostics/1106-diagnostics-binop-operand-type-check.sx:19:10
|
||||
|
|
||||
19 | a := n + s; // arithmetic: i64 + string
|
||||
| ^
|
||||
|
||||
error: cannot apply '*' to operands of type 'string' and 'i64'
|
||||
--> examples/diagnostics/1106-diagnostics-binop-operand-type-check.sx:20:10
|
||||
|
|
||||
20 | b := s * n; // arithmetic: non-numeric LHS (string * i64)
|
||||
| ^
|
||||
|
||||
error: cannot apply '<' to operands of type 'i64' and 'string'
|
||||
--> examples/diagnostics/1106-diagnostics-binop-operand-type-check.sx:21:10
|
||||
|
|
||||
21 | c := n < s; // ordering: i64 < string
|
||||
| ^
|
||||
|
||||
error: cannot apply '&' to operands of type 'i64' and 'string'
|
||||
--> examples/diagnostics/1106-diagnostics-binop-operand-type-check.sx:22:10
|
||||
|
|
||||
22 | d := n & s; // bitwise: i64 & string
|
||||
| ^
|
||||
|
||||
error: cannot apply '<<' to operands of type 'i64' and 'string'
|
||||
--> examples/diagnostics/1106-diagnostics-binop-operand-type-check.sx:23:10
|
||||
|
|
||||
23 | e := n << s; // shift: i64 << string
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,10 @@
|
||||
error: by-reference loop capture 'm' has type '*Move', but 'Move' is expected here
|
||||
--> examples/diagnostics/1107-diagnostics-ref-capture-value-arg-diagnostic.sx:15:14
|
||||
|
|
||||
15 | take(m);
|
||||
| ^
|
||||
|
||||
help: dereference it to pass the value: `m.*`
|
||||
|
|
||||
15 | m.*
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,10 @@
|
||||
error: argument 'm' has type '*Move', but 'Move' is expected here
|
||||
--> examples/diagnostics/1108-diagnostics-pointer-param-value-arg-diagnostic.sx:13:44
|
||||
|
|
||||
13 | forward :: (m: *Move) -> i64 { return take(m); }
|
||||
| ^
|
||||
|
||||
help: dereference it to pass the value: `m.*`
|
||||
|
|
||||
13 | m.*
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: cannot dereference with `.*`: 'Point' is not a pointer
|
||||
--> examples/diagnostics/1109-diagnostics-deref-non-pointer-reject.sx:12:10
|
||||
|
|
||||
12 | q := p.*; // ERROR: `p` is a Point value, not a pointer
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
w.s.v = 42
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,11 @@
|
||||
error: 'T' is a value parameter, not a type; introduce a generic type parameter with `$T: Type`
|
||||
--> examples/diagnostics/1111-diagnostics-nondollar-type-param-rejected.sx:6:37
|
||||
|
|
||||
6 | idwrap :: (T: Type, f: Closure() -> T) -> T { return f(); }
|
||||
| ^
|
||||
|
||||
error: 'T' is a value parameter, not a type; introduce a generic type parameter with `$T: Type`
|
||||
--> examples/diagnostics/1111-diagnostics-nondollar-type-param-rejected.sx:6:43
|
||||
|
|
||||
6 | idwrap :: (T: Type, f: Closure() -> T) -> T { return f(); }
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unknown type 'Coordnate'
|
||||
--> examples/diagnostics/1112-diagnostics-unknown-type-name-rejected.sx:8:8
|
||||
|
|
||||
8 | y: Coordnate; // typo for a non-existent type
|
||||
| ^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unknown type 'Coordnate'
|
||||
--> examples/diagnostics/1113-diagnostics-unknown-type-local-var-rejected.sx:8:8
|
||||
|
|
||||
8 | v: Coordnate = 5;
|
||||
| ^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unknown type 'Coordnate'
|
||||
--> examples/diagnostics/1114-diagnostics-unknown-type-nested-closure-rejected.sx:8:14
|
||||
|
|
||||
8 | bad: Coordnate = ---;
|
||||
| ^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: 'T' is a value parameter, not a type; introduce a generic type parameter with `$T: Type`
|
||||
--> examples/diagnostics/1115-diagnostics-cast-value-param-rejected.sx:7:17
|
||||
|
|
||||
7 | return cast(T) x;
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: tuple type element is not a type (found `int_literal`); a tuple used as a type must list only types, e.g. `(i32, i32)`
|
||||
--> examples/diagnostics/1116-diagnostics-tuple-type-nontype-element-rejected.sx:11:55
|
||||
|
|
||||
11 | print("bad tuple type size = {}\n", size_of((i32, 1)));
|
||||
| ^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: unknown type 'NotAType'
|
||||
--> examples/diagnostics/1117-diagnostics-value-const-as-type-rejected.sx:15:8
|
||||
|
|
||||
15 | v: NotAType = ---;
|
||||
| ^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: global 'g' must be initialized by a compile-time constant
|
||||
--> examples/diagnostics/1118-diagnostics-global-non-const-initializer-rejected.sx:14:11
|
||||
|
|
||||
14 | g : i32 = K.x;
|
||||
| ^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,23 @@
|
||||
error: 'u8' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1119-diagnostics-reserved-type-name-as-identifier.sx:9:14
|
||||
|
|
||||
9 | takes_u8 :: (u8: i32) -> i32 { return u8; }
|
||||
| ^^
|
||||
|
||||
error: 'i64' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1119-diagnostics-reserved-type-name-as-identifier.sx:12:5
|
||||
|
|
||||
12 | i64 : i32 = 3;
|
||||
| ^^^
|
||||
|
||||
error: 'bool' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1119-diagnostics-reserved-type-name-as-identifier.sx:13:5
|
||||
|
|
||||
13 | bool : bool = true;
|
||||
| ^^^^
|
||||
|
||||
error: 'string' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1119-diagnostics-reserved-type-name-as-identifier.sx:14:5
|
||||
|
|
||||
14 | string := "x";
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: 'i2' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1120-diagnostics-imported-reserved-type-name/mod.sx:11:5
|
||||
|
|
||||
11 | i2 := Box.{ total = 0, count = 0 };
|
||||
| ^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,35 @@
|
||||
error: 'i2' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1121-diagnostics-reserved-name-control-flow.sx:18:5
|
||||
|
|
||||
18 | i2, rest := pair(); // destructure name
|
||||
| ^^
|
||||
|
||||
error: 'u8' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1121-diagnostics-reserved-name-control-flow.sx:19:8
|
||||
|
|
||||
19 | if u8 := maybe() { } // if optional binding
|
||||
| ^^
|
||||
|
||||
error: 'i16' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1121-diagnostics-reserved-name-control-flow.sx:20:11
|
||||
|
|
||||
20 | while i16 := maybe() { break; } // while optional binding
|
||||
| ^^^
|
||||
|
||||
error: 'bool' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1121-diagnostics-reserved-name-control-flow.sx:22:13
|
||||
|
|
||||
22 | for xs (bool) { } // for capture name
|
||||
| ^^^^
|
||||
|
||||
error: 'i32' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1121-diagnostics-reserved-name-control-flow.sx:23:21
|
||||
|
|
||||
23 | for xs, 0.. (v, i32) { } // for index name
|
||||
| ^^^
|
||||
|
||||
error: 'string' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1121-diagnostics-reserved-name-control-flow.sx:26:22
|
||||
|
|
||||
26 | case .some: (string) { 0 }
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,11 @@
|
||||
error: 'u8' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1122-diagnostics-reserved-name-impl-method.sx:19:24
|
||||
|
|
||||
19 | go :: (self: *Box, u8: i64) {
|
||||
| ^^
|
||||
|
||||
error: 'i2' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1122-diagnostics-reserved-name-impl-method.sx:20:9
|
||||
|
|
||||
20 | i2 := Box.{ total = 1 };
|
||||
| ^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,11 @@
|
||||
error: 'i64' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1123-diagnostics-reserved-name-catch-onfail.sx:20:13
|
||||
|
|
||||
20 | onfail (i64) { } // onfail tag binding
|
||||
| ^^^
|
||||
|
||||
error: 'u8' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1123-diagnostics-reserved-name-catch-onfail.sx:21:20
|
||||
|
|
||||
21 | must(n) catch (u8) { return; }; // catch tag binding
|
||||
| ^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: 'i2' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1124-diagnostics-imported-reserved-destructure/mod.sx:6:5
|
||||
|
|
||||
6 | i2, rest := pair(); // destructure name in an IMPORTED module
|
||||
| ^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,11 @@
|
||||
error: 'u8' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1125-diagnostics-reserved-name-method-param.sx:15:28
|
||||
|
|
||||
15 | greet :: (self: *Self, u8: i64) -> i64 {
|
||||
| ^^
|
||||
|
||||
error: 'i16' is a reserved type name and cannot be used as an identifier
|
||||
--> examples/diagnostics/1125-diagnostics-reserved-name-method-param.sx:23:27
|
||||
|
|
||||
23 | bump :: (self: *Self, i16: i32) {
|
||||
| ^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: global 'boxes' must be initialized by a compile-time constant
|
||||
--> examples/diagnostics/1126-diagnostics-global-aggregate-non-const-field-rejected.sx:16:18
|
||||
|
|
||||
16 | boxes : [1]Box = .[ .{ p = null, marker = runtime_marker() } ];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: '.purple' is not a variant of enum 'Color'
|
||||
--> examples/diagnostics/1127-diagnostics-global-enum-literal-bad-variant.sx:11:15
|
||||
|
|
||||
11 | bad : Color = .purple;
|
||||
| ^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1 @@
|
||||
error: comptime init of 'fp' produced a reference to function 'add', which cannot be serialized as a static constant (function declarations are not available at global-init time)
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: type alias 'BadArr' could not be resolved: an array dimension is not a compile-time integer constant
|
||||
--> examples/diagnostics/1129-diagnostics-array-dim-not-const.sx:18:11
|
||||
|
|
||||
18 | BadArr :: [get()]i64;
|
||||
| ^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: array dimension 5000000000 does not fit in u32
|
||||
--> examples/diagnostics/1130-diagnostics-array-dim-oversized-u32.sx:13:10
|
||||
|
|
||||
13 | a : [5000000000]i64 = ---;
|
||||
| ^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: atomic ops require a scalar type (integer/float/bool/pointer/enum/vector) of size 1/2/4/8/16 bytes — '[8]u8' is not eligible
|
||||
--> examples/diagnostics/1130-diagnostics-atomic-nonscalar.sx:8:22
|
||||
|
|
||||
8 | x := atomic_load([8]u8, @arr, .seq_cst);
|
||||
| ^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: array dimension 5000000000 does not fit in u32
|
||||
--> examples/diagnostics/1131-diagnostics-array-dim-oversized-u32-alias.sx:18:9
|
||||
|
|
||||
18 | Big :: [5000000000]i64;
|
||||
| ^^^^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user