test: port 839_xmod_nominal_typeeqast to corpus fixtures

839_xmod_nominal_typeeqast.c -> r839_xmod_nominal_match (run-exit 42),
  r839_xmod_a6_concrete (run), r839_xmod_incompat_concrete (error
  'not assignable'), r839_xmod_distinct_alias (error 'ambiguous
  without nominal layout').

r839_xmod_nominal_match enters DATABYTEID_DIVERGED: the carrier waived
byte-id for the pre-existing cross-module tagged-return spill
divergence; the DIVERGED row makes it loud-on-fix instead. The
typeeqast-layer discriminator itself stays with the lib byteid gate
(test/byteid/libbyteid_test.ww), as the carrier documented.
This commit is contained in:
2026-08-08 14:30:11 +09:00
parent 2680fba303
commit 5a8b662d6e
7 changed files with 62 additions and 309 deletions

View File

@@ -0,0 +1,9 @@
//ww:run
// migrated from test/wcc/839_xmod_nominal_typeeqast.c: A6 — concrete e.myerr returned into e.res (bare-vs-qualified nominal forward), both stages accept.
package e;
export type myerr = !i64;
export type res = (i64 | myerr);
package main;
import e;
fn wrap(x: e.myerr) e.res = { return x; };
export fn main() i32 = { return 0; };

View File

@@ -0,0 +1,10 @@
//ww:error "ambiguous without nominal layout"
// migrated from test/wcc/839_xmod_nominal_typeeqast.c: a distinct local alias over the same underlying i64 into e.res — #95 structural-ambiguity reject, both stages.
package e;
export type myerr = !i64;
export type res = (i64 | myerr);
package main;
import e;
type other = !i64;
fn f(x: other) e.res = { return x; };
export fn main() i32 = { return 0; };

View File

@@ -0,0 +1,9 @@
//ww:error "not assignable"
// migrated from test/wcc/839_xmod_nominal_typeeqast.c: str into (i64 | e.myerr) has no variant — confident reject, both stages.
package e;
export type myerr = !i64;
package main;
import e;
type u = (i64 | e.myerr);
fn bad(s: str) u = { return s; };
export fn main() i32 = { return 0; };

View File

@@ -0,0 +1,22 @@
//ww:run-exit 42
// migrated from test/wcc/839_xmod_nominal_typeeqast.c: bare-spelled union variants matched via QUALIFIED case patterns (`case let x: e.myerr`) — cross-module nominal cover.
package e;
export type myerr = !i64;
export type res = (i64 | myerr);
export fn ok(v: i64) res = { return v; };
export fn bad() res = { return (-7: myerr); };
package main;
import e;
fn unwrap(r: e.res) i64 = {
match (r) {
case let n: i64 => return n;
case let x: e.myerr => return -1;
};
};
export fn main() i32 = {
let a = unwrap(e.ok(40));
let b = unwrap(e.bad());
if (a != 40) { return 11; };
if (b != -1) { return 12; };
return 42;
};