lang F0.3: multi-message diagnostic bundling + help-blocks

Feature 0 complete. addNote/addHelp bundle notes and help-blocks under a
primary diagnostic (handle from new addId/addFmtId); help blocks carry an
optional fix-it line that substitutes the suggested source. renderExtended
now renders primary -> notes -> helps with blank-line separators.

Wire the CLI to the extended renderer (renderErrors -> renderStderr) and
flip render_style default to .extended; the previous renderErrors ->
renderDebug path bypassed render() entirely, so flipping the field alone
was a no-op. 13 diagnostic snapshots re-rendered to the extended format.
This commit is contained in:
agra
2026-05-29 09:36:53 +03:00
parent cc08f9a9fe
commit 9bf3dc75e6
17 changed files with 328 additions and 44 deletions

View File

@@ -1,3 +1,17 @@
/Users/agra/projects/sx/examples/127-import-non-transitive.sx:15:37: error: 'c_only_fn' is not visible; #import the module that declares it
/Users/agra/projects/sx/examples/127-import-non-transitive.sx:16:40: error: 'c_only_const' is not visible; #import the module that declares it
/Users/agra/projects/sx/examples/127-import-non-transitive.sx:16:40: error: unresolved 'c_only_const' (in /Users/agra/projects/sx/examples/127-import-non-transitive.sx fn main)
error: 'c_only_fn' is not visible; #import the module that declares it
--> /Users/agra/projects/sx/examples/127-import-non-transitive.sx:15:37
|
15 | print("c_only_fn direct: {}\n", c_only_fn());
| ^^^^^^^^^
error: 'c_only_const' is not visible; #import the module that declares it
--> /Users/agra/projects/sx/examples/127-import-non-transitive.sx:16:40
|
16 | print("c_only_const direct: {}\n", c_only_const);
| ^^^^^^^^^^^^
error: unresolved 'c_only_const' (in /Users/agra/projects/sx/examples/127-import-non-transitive.sx fn main)
--> /Users/agra/projects/sx/examples/127-import-non-transitive.sx:16:40
|
16 | print("c_only_const direct: {}\n", c_only_const);
| ^^^^^^^^^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/131-callconv-mismatch-diagnostic.sx:12:42: error: call-convention mismatch: 'sx_handler' is declared with default sx convention but the target type expects callconv(.c)
error: call-convention mismatch: 'sx_handler' is declared with default sx convention but the target type expects callconv(.c)
--> /Users/agra/projects/sx/examples/131-callconv-mismatch-diagnostic.sx:12:42
|
12 | fp : (*void) -> *void callconv(.c) = sx_handler;
| ^^^^^^^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/161-pack-index-oob.sx:14:32: error: pack index 2 out of bounds: 'args' has 1 element
error: pack index 2 out of bounds: 'args' has 1 element
--> /Users/agra/projects/sx/examples/161-pack-index-oob.sx:14:32
|
14 | foo :: (..$args) -> $R => args[2];
| ^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/./179-impl-visibility-user.sx:7:17: error: no visible xx conversion from 's64' to 'Wrap' — impl exists in another module but is not imported
error: no visible xx conversion from 's64' to 'Wrap' — impl exists in another module but is not imported
--> /Users/agra/projects/sx/examples/./179-impl-visibility-user.sx:7:17
|
7 | w : Wrap = xx 7;
| ^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/180-impl-duplicate.sx:20:17: error: duplicate xx conversion from 's64' to 'Wrap': impls in /Users/agra/projects/sx/examples/./180-impl-duplicate-impl-a.sx and /Users/agra/projects/sx/examples/./180-impl-duplicate-impl-b.sx
error: duplicate xx conversion from 's64' to 'Wrap': impls in /Users/agra/projects/sx/examples/./180-impl-duplicate-impl-a.sx and /Users/agra/projects/sx/examples/./180-impl-duplicate-impl-b.sx
--> /Users/agra/projects/sx/examples/180-impl-duplicate.sx:20:17
|
20 | w : Wrap = xx 7;
| ^

View File

@@ -1 +1,9 @@
/Users/agra/projects/sx/examples/181-impl-duplicate-same-file.sx:15:1: error: duplicate impl 'Into' for source 's64' in /Users/agra/projects/sx/examples/181-impl-duplicate-same-file.sx
error: duplicate impl 'Into' for source 's64' in /Users/agra/projects/sx/examples/181-impl-duplicate-same-file.sx
--> /Users/agra/projects/sx/examples/181-impl-duplicate-same-file.sx:15:1
|
15 | impl Into(MyA) for s64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^
16 | convert :: (self: s64) -> MyA { .{ v = self * 2 }; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 | }
| ^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/187-compile-error.sx:12:6: error: intentional compile error from #run
error: intentional compile error from #run
--> /Users/agra/projects/sx/examples/187-compile-error.sx:12:6
|
12 | #run compile_error("intentional compile error from #run");
| ^^^^^^^^^^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/55-err-field-not-found.sx:8:15: error: field 'bogus' not found on type 'Vec'
error: field 'bogus' not found on type 'Vec'
--> /Users/agra/projects/sx/examples/55-err-field-not-found.sx:8:15
|
8 | return xx v.bogus;
| ^^^^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/56-err-tuple-oob.sx:6:15: error: field '42' not found on type 'tuple'
error: field '42' not found on type 'tuple'
--> /Users/agra/projects/sx/examples/56-err-tuple-oob.sx:6:15
|
6 | return xx t.42;
| ^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/57-err-dot-shorthand.sx:5:10: error: cannot infer enum type for '.Foo' — use an explicit type or assign to a typed variable
error: cannot infer enum type for '.Foo' — use an explicit type or assign to a typed variable
--> /Users/agra/projects/sx/examples/57-err-dot-shorthand.sx:5:10
|
5 | x := .Foo(1, 2);
| ^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/59-err-bad-variant.sx:18:14: error: no variant 'Bogus' on type 'Shape'
error: no variant 'Bogus' on type 'Shape'
--> /Users/agra/projects/sx/examples/59-err-bad-variant.sx:18:14
|
18 | case .Bogus: (x) { print("bogus={}\n", x); }
| ^^^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/ffi-jni-call-11-unsupported-return-diag.sx:24:14: error: JNI method 'Buf.get' returns 's8', which isn't supported by the JNI call-method lowering yet — only void/bool/s32/s64/f32/f64 and pointers are wired up
error: JNI method 'Buf.get' returns 's8', which isn't supported by the JNI call-method lowering yet — only void/bool/s32/s64/f32/f64 and pointers are wired up
--> /Users/agra/projects/sx/examples/ffi-jni-call-11-unsupported-return-diag.sx:24:14
|
24 | _ := b.get();
| ^^^^^

View File

@@ -1 +1,5 @@
/Users/agra/projects/sx/examples/ffi-objc-dsl-04-mismatch.sx:18:14: error: Obj-C selector for 'SxProbeMismatch.something_extra' has 2 keyword(s) but the call passes 1 argument(s); split the sx method name on '_' so it produces exactly 1 keyword(s), or override with `#selector("...")`
error: Obj-C selector for 'SxProbeMismatch.something_extra' has 2 keyword(s) but the call passes 1 argument(s); split the sx method name on '_' so it produces exactly 1 keyword(s), or override with `#selector("...")`
--> /Users/agra/projects/sx/examples/ffi-objc-dsl-04-mismatch.sx:18:14
|
18 | n := inst.something_extra(7);
| ^^^^^^^^^^^^^^^^^^^^