issues 0033 + 0034: rename repros to focused regression tests

Both repros emit their target diagnostics cleanly today (verified
2026-05-28 against HEAD):

- `issue-0033` → "no visible xx conversion from 's64' to 'Wrap'
  — impl exists in another module but is not imported". Catches
  the case where an `impl Into(X) for Y` is registered globally
  via one module's import chain but is NOT transitively imported
  by the file containing the `xx` site.
- `issue-0034` → "duplicate xx conversion from 's64' to 'Wrap':
  impls in <a> and <b>". Catches two impls covering the same
  (Source, Target) pair both reachable from a single `xx` site.

Renamed to focused feature names:

- `issue-0033*` → `179-impl-visibility*` (4 files: main + impl +
  types + user).
- `issue-0034*` → `180-impl-duplicate*` (4 files: main + impl-a +
  impl-b + types).

Path references inside the files updated. Comment headers tightened
to feature-focused (drop issue-NNNN provenance — that's in git
history now). Expected `.txt` / `.exit` files captured against the
full diagnostic text and exit code 1.

The `issue-*` namespace in `examples/` now shrinks to the literal
list of UNRESOLVED bug repros. 218/218.
This commit is contained in:
agra
2026-05-28 12:08:54 +03:00
parent 6fdfe8d073
commit da6f318a3f
20 changed files with 56 additions and 42 deletions

View File

@@ -1,7 +1,7 @@
// Helper that defines the impl. issue-0033's user file does NOT
// Helper that defines the impl. 179-impl-visibility's user file does NOT
// directly import this — that's the whole point of the test.
#import "modules/std.sx";
#import "./issue-0033-types.sx";
#import "./179-impl-visibility-types.sx";
impl Into(Wrap) for s64 {
convert :: (self: s64) -> Wrap {

View File

@@ -0,0 +1,2 @@
// Shared type for 179-impl-visibility — Wrap struct.
Wrap :: struct { v: s64 = 0; }

View File

@@ -1,7 +1,7 @@
// User file uses xx but only imports the shared types — NOT the impl.
// The Phase 4 visibility filter should reject the impl from issue-0033-impl.sx.
// The Phase 4 visibility filter should reject the impl from 179-impl-visibility-impl.sx.
#import "modules/std.sx";
#import "./issue-0033-types.sx";
#import "./179-impl-visibility-types.sx";
run_user :: () -> s32 {
w : Wrap = xx 7;

View File

@@ -0,0 +1,21 @@
// Impl visibility — an `impl Into(...) for ...` is registered into
// the global impl table when its module is imported anywhere in the
// program, but is only **visible** from files that themselves
// transitively import the impl's defining module.
//
// Setup:
// - 179-impl-visibility-impl.sx declares an `impl Into(Wrap) for s64`.
// - 179-impl-visibility-user.sx tries `xx 7 : Wrap` but only
// imports the shared types — NOT the impl module.
// - The xx at the user-file site must produce a "no visible xx
// conversion" diagnostic, not silently fall through to whatever
// was registered in another module.
//
// The diagnostic is the success criterion — the compile error is the
// expected output. Tests/expected/.txt captures it; .exit is 1.
#import "modules/std.sx";
#import "./179-impl-visibility-impl.sx";
#import "./179-impl-visibility-user.sx";
main :: () -> s32 { run_user(); }

View File

@@ -1,6 +1,6 @@
// Helper A — one of two conflicting impls for the same (s64, Wrap) pair.
#import "modules/std.sx";
#import "./issue-0034-types.sx";
#import "./180-impl-duplicate-types.sx";
impl Into(Wrap) for s64 {
convert :: (self: s64) -> Wrap {

View File

@@ -1,6 +1,6 @@
// Helper B — second conflicting impl for the same (s64, Wrap) pair.
#import "modules/std.sx";
#import "./issue-0034-types.sx";
#import "./180-impl-duplicate-types.sx";
impl Into(Wrap) for s64 {
convert :: (self: s64) -> Wrap {

View File

@@ -0,0 +1,2 @@
// Shared type for 180-impl-duplicate.
Wrap :: struct { v: s64 = 0; }

View File

@@ -0,0 +1,23 @@
// Duplicate impl detection — two impls for the same (Source, Target)
// pair are both visible from the same `xx` site (because both their
// defining modules are transitively imported). The compiler must
// emit a "duplicate xx conversion" diagnostic naming both modules,
// not silently pick one or the other.
//
// Setup:
// - 180-impl-duplicate-impl-a.sx: `impl Into(Wrap) for s64` (mul by 10).
// - 180-impl-duplicate-impl-b.sx: `impl Into(Wrap) for s64` (add 100).
// - Main imports both; the `xx 7 : Wrap` site must error.
//
// Expected exit = 1, expected output = the focused diagnostic naming
// both impl modules.
#import "modules/std.sx";
#import "./180-impl-duplicate-impl-a.sx";
#import "./180-impl-duplicate-impl-b.sx";
main :: () -> s32 {
w : Wrap = xx 7;
print("w.v = {}\n", w.v);
0;
}

View File

@@ -1,2 +0,0 @@
// Shared type for issue-0033 — Wrap struct.
Wrap :: struct { v: s64 = 0; }

View File

@@ -1,16 +0,0 @@
// Phase 4 verification: an `impl Into(...) for ...` is registered into the
// global impl table when its module is imported anywhere in the program, but
// is only **visible** from files that themselves transitively import the impl's
// defining module. Here:
// - issue-0033-impl.sx declares an `impl Into(Wrap) for s64`.
// - issue-0033-user.sx tries to `xx 7 : Wrap` but only imports the shared
// types — not the impl module.
// - The xx at issue-0033-user.sx:7 must produce a clean "no visible xx
// conversion" diagnostic, not silently fall through to whatever was
// registered in another module.
#import "modules/std.sx";
#import "./issue-0033-impl.sx";
#import "./issue-0033-user.sx";
main :: () -> s32 { run_user(); }

View File

@@ -1,2 +0,0 @@
// Shared type for issue-0034.
Wrap :: struct { v: s64 = 0; }

View File

@@ -1,14 +0,0 @@
// Phase 5 verification: two impls for the same (Source, Target) pair are
// both visible from the same xx site (because both their defining modules
// are transitively imported). The compiler must emit a clean
// "duplicate xx conversion" diagnostic naming both modules.
#import "modules/std.sx";
#import "./issue-0034-impl-a.sx";
#import "./issue-0034-impl-b.sx";
main :: () -> s32 {
w : Wrap = xx 7;
print("w.v = {}\n", w.v);
0;
}

BIN
probe_0043 Executable file

Binary file not shown.

0
probe_stdout Executable file
View File

View File

@@ -0,0 +1 @@
/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

View File

@@ -0,0 +1 @@
/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

View File

@@ -1 +0,0 @@
/Users/agra/projects/sx/examples/./issue-0033-user.sx:7:17: error: no visible xx conversion from 's64' to 'Wrap' — impl exists in another module but is not imported

View File

@@ -1 +0,0 @@
/Users/agra/projects/sx/examples/issue-0034.sx:11:17: error: duplicate xx conversion from 's64' to 'Wrap': impls in /Users/agra/projects/sx/examples/./issue-0034-impl-a.sx and /Users/agra/projects/sx/examples/./issue-0034-impl-b.sx