ww: select build action from package declaration
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
// p2() = mod2.ping = 31
|
||||
// total = 112
|
||||
|
||||
package fnlabelmangle;
|
||||
package main;
|
||||
|
||||
import mod1;
|
||||
import mod2;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// own module — must NOT trip crossmod's param, even though a sibling
|
||||
// module in the same bundle imports that leaf. Build + run; exit = 2.
|
||||
|
||||
package paramshadowmod;
|
||||
package main;
|
||||
|
||||
import shadowmod;
|
||||
import crossmod;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// imported module's bareword, so the rule doesn't fire and the body
|
||||
// can call `shadowmod.say()` cleanly. Built + run; exit code = 42.
|
||||
|
||||
package paramshadowmod;
|
||||
package main;
|
||||
|
||||
import shadowmod;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 26
|
||||
package main;
|
||||
// migrated from test/wcc/696_modtype_leaf_collision.c: same-leaf cross-module `type stream` must stay mod-tagged (pre-fix sym smash cross-bound the fields).
|
||||
package mod1;
|
||||
export type stream = struct {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_DEF promotion must keep use_alias so `defmod.flag` resolves.
|
||||
package defmod;
|
||||
export def defmod: i32 = 0i32;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_FN promotion (the original bug) must keep use_alias or `fnmod.flag` fails "unknown type".
|
||||
package fnmod;
|
||||
export type flag = enum i32 {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_TYPE in-place promotion keeps use_alias so `typmod.flag` resolves (check.c self-import branch).
|
||||
package typmod;
|
||||
export type typmod = struct {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// migrated from test/wcc/699_use_promote_alias.c: SK_USE->SK_VAR promotion must keep use_alias so `varmod.flag` resolves.
|
||||
package varmod;
|
||||
export let varmod: i32 = 0i32;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 107
|
||||
package main;
|
||||
// Migrated from 700_e2e row 40.
|
||||
package myos;
|
||||
fn alloc(n: i64) i64 = { return n + 100; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// Migrated from 700_e2e row 123.
|
||||
package pkg;
|
||||
export type base = enum i32 { DEC = 10, HEX = 16 };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 1
|
||||
package main;
|
||||
// Migrated from 700_e2e row 118.
|
||||
package pkg;
|
||||
type dir = enum { NORTH, SOUTH, EAST, WEST };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// migrated from test/wcc/732_def_const_fold.c: cross-module def-RHS fold (`def K = a.J + 1`) must emit the folded DATA row; run-exit links AND reads the value.
|
||||
package a;
|
||||
export def J: i32 = 41;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 5
|
||||
package main;
|
||||
package aa;
|
||||
export def K: i32 = 5;
|
||||
export fn getk() i32 = { return K; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 7
|
||||
package main;
|
||||
package aa;
|
||||
export let v: i32 = 7;
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 7
|
||||
package main;
|
||||
package aa;
|
||||
export let v: i32 = 7;
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 2
|
||||
package main;
|
||||
package aa;
|
||||
export let f: f64 = 2.5;
|
||||
export fn getf() f64 = { return f; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 7
|
||||
package main;
|
||||
package aa;
|
||||
export let v: i32 = 7;
|
||||
export fn getv() i32 = { return v; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// 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;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// 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;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//ww:run-exit 7
|
||||
package main;
|
||||
package cmatrix;
|
||||
fn main() i32 = { return 7; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 37
|
||||
package main;
|
||||
package pkg;
|
||||
export type point = struct { x: i64, y: i64 };
|
||||
export type rect = struct { lo: point, hi: point };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 18
|
||||
package main;
|
||||
package pkg;
|
||||
export type point = struct { x: i64, y: i64 };
|
||||
export type rect = struct { lo: point, hi: point };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 27
|
||||
package main;
|
||||
package pkg;
|
||||
export type point = struct { x: i64, y: i64 };
|
||||
export type rect = struct { lo: point, hi: point };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/915_arr_module_index_run.c: cross-package mod.arr[0] — LEAQ base + u16 load width (#128b).
|
||||
package wcmodarr;
|
||||
export let probe_table: [8]u16 = [0u16, 0x0800u16, 0x0801u16, 0x0803u16, 0x1006u16, 0x1009u16, 0x100Du16, 0x1812u16];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 1
|
||||
package main;
|
||||
// migrated from test/wcc/915_arr_module_index_run.c: nontrivial index — the pre-fix MOVQ-not-LEAQ segfault repro; 0x0801 mod 256 = 1.
|
||||
package wcmodarr;
|
||||
export let probe_table: [8]u16 = [0u16, 0x0800u16, 0x0801u16, 0x0803u16, 0x1006u16, 0x1009u16, 0x100Du16, 0x1812u16];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 6
|
||||
package main;
|
||||
// migrated from test/wcc/915_arr_module_index_run.c: per-element stride pin; 0x1006 mod 256 = 6.
|
||||
package wcmodarr;
|
||||
export let probe_table: [8]u16 = [0u16, 0x0800u16, 0x0801u16, 0x0803u16, 0x1006u16, 0x1009u16, 0x100Du16, 0x1812u16];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 18
|
||||
package main;
|
||||
package myf;
|
||||
export type pt = struct { x: i32, y: i32 };
|
||||
export def P: pt = pt{x=7, y=11};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 7
|
||||
package main;
|
||||
package myf;
|
||||
export fn helper() i32 = { return 42; };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 18
|
||||
package main;
|
||||
package myf;
|
||||
export type pt = struct { x: i32, y: i32 };
|
||||
export let L: pt = pt{x=7, y=11};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
package myf;
|
||||
export let S: i32 = 42;
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/929_match_4arm_cross_module_run.c: 3-arm boundary — arm 2 must reach its body under the shadowed callee.
|
||||
package a;
|
||||
export type more = void;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/929_match_4arm_cross_module_run.c: mixed variant kinds (i32|str|rune|u8) — the shadowed-resolution fix is not shape-specific.
|
||||
package a;
|
||||
export fn next(k: i32) (i32 | str | rune | u8) = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/929_match_4arm_cross_module_run.c: canonical 4-arm — caller fn `next` shadows callee a.next; every arm body must fire (#31 fnretlookupmod).
|
||||
package a;
|
||||
export type more = void;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/929_match_4arm_cross_module_run.c: reverse arm order — dispatch follows the callee's variant indices, not source order.
|
||||
package a;
|
||||
export type more = void;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/929_match_4arm_cross_module_run.c: 5-arm scaling — arms 3 and 4 must each reach their body.
|
||||
package a;
|
||||
export type more = void;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/929_match_4arm_cross_module_run.c: 6-arm — every arm beyond the caller's variant count was broken, not just arm 2/3.
|
||||
package a;
|
||||
export type more = void;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
// migrated from test/wcc/949_xmod_fnptr_const_run.c: cross-module &cc.fn inside const table + scalar emits the &fn->DATAR reloc (#124); DISTINCT predicates catch a swapped reloc.
|
||||
package cc;
|
||||
export fn isa(c: rune) bool = { return c == 'a'; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 249
|
||||
package main;
|
||||
package myf;
|
||||
export fn g() f64 = { return -7.0; };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 253
|
||||
package main;
|
||||
package myf;
|
||||
export fn g() f64 = { return -3.9; };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 3
|
||||
package main;
|
||||
package myf;
|
||||
export fn g() f64 = { return 3.9; };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 242
|
||||
package main;
|
||||
package myf;
|
||||
export fn g() f64 = { return -7.0; };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 8
|
||||
package main;
|
||||
package myf;
|
||||
export fn g() f64 = { return -7.0; };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run
|
||||
package main;
|
||||
package myf;
|
||||
export fn frexp(n: f64) (f64, i64) = {
|
||||
if (n == 0.0) { return (0.0, 0i64); };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 4
|
||||
package main;
|
||||
package myf;
|
||||
export fn fs(n: f64) (f64, str) = {
|
||||
if (n == 0.0) { return (n, "x"); };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 15
|
||||
package main;
|
||||
package myf;
|
||||
export fn addi64(a: i64, b: i64) (i64, bool) = {
|
||||
let s: i64 = a + b;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 10
|
||||
package main;
|
||||
package beta;
|
||||
export fn dup() (i64, i64) = { return (3i64, 7i64); };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
package m;
|
||||
export fn f() i32 = {
|
||||
assert(3 > 2, "m.f invariant");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
package m;
|
||||
export fn assert(b: bool, msg: str) void = { };
|
||||
package main;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
// Current-module &fn lookup must beat a later same-leaf declaration.
|
||||
package beta;
|
||||
export type hfn = fn(x: i32) i32;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
package beta;
|
||||
export type berr = !void;
|
||||
export fn op() (i32 | berr) = { return 5; };
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//ww:run-exit 42
|
||||
package main;
|
||||
package beta;
|
||||
export type berr = !void;
|
||||
export fn op() (i32 | berr) = { return 5; };
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
// task; until then we exercise polymorphism via ctx pointers, which
|
||||
// is what the real port wants anyway.
|
||||
|
||||
package test;
|
||||
package main;
|
||||
|
||||
import os;
|
||||
import strconv;
|
||||
|
||||
Reference in New Issue
Block a user