test: migrate examples to XXXX-category-name layout + split expected streams
Rename all example tests/companions to the XXXX-category-test-name scheme (per-category 100-blocks: basic 0010, types 0100, ... errors 1000, diagnostics 1100, ffi 1200, ffi-objc 1300, ffi-jni 1400, vectors 1500, platform 1600). Companions and dir/C fixtures move in lockstep with their parent test; #import/#source/#include paths rewritten to match. Expected output now lives in examples/expected/ (a sibling dir of the tests) split into three streams per the new convention: <name>.exit / <name>.stdout / <name>.stderr (+ optional <name>.ir) run_examples.sh rewritten: scans examples/ and issues/ for an expected/<name>.exit marker, captures stdout and stderr separately (no more 2>&1), compares each stream + exit + optional IR snapshot. Behavior validated unchanged: every renamed test reproduces its prior merged output + exit (diffs limited to file paths/basenames embedded in diagnostics + traces, which correctly reflect the new names). Suite: 292 passed, 0 failed. 50-smoke.sx split + issue relocation + docs follow in subsequent commits.
This commit is contained in:
46
examples/0504-packs-pack-impl-match.sx
Normal file
46
examples/0504-packs-pack-impl-match.sx
Normal file
@@ -0,0 +1,46 @@
|
||||
// Variadic heterogeneous type packs — `..$args` — impl matching
|
||||
// lock-in.
|
||||
//
|
||||
// Step 1d slice for the pack feature (see
|
||||
// ~/.claude/plans/lets-see-options-for-merry-dijkstra.md). Pins
|
||||
// today's concrete-only impl-matching behaviour: a user-declared
|
||||
// `impl Into(Block) for Closure(..$args) -> $R` does NOT match
|
||||
// any concrete closure source type. The xx cast site hits the
|
||||
// existing "no `Into(Block) for <src>` impl" diagnostic even
|
||||
// though the pack impl is reachable.
|
||||
//
|
||||
// Next commit (1d.B) teaches `tryUserConversion` /
|
||||
// `registerParamImpl` to walk a second `param_impl_pack_map`
|
||||
// when the concrete-key miss happens. Pack impls bind their
|
||||
// `$args` and `$R` to the concrete source closure's tail types
|
||||
// and return; monomorphisation proceeds against those bindings.
|
||||
//
|
||||
// The `Closure(s32, bool) -> bool` shape is not covered by
|
||||
// stdlib's hand-rolled impls (only `Closure() -> void` and
|
||||
// `Closure(bool) -> void`) and not covered by 96-block-multi-arg's
|
||||
// `Closure(s32, *void) -> void` impl, so the pack impl is the
|
||||
// only candidate.
|
||||
|
||||
#import "modules/std.sx";
|
||||
#import "modules/std/objc_block.sx";
|
||||
|
||||
impl Into(Block) for Closure(..$args) -> $R {
|
||||
convert :: (self: Closure(..$args) -> $R) -> Block {
|
||||
.{
|
||||
isa = @_NSConcreteStackBlock,
|
||||
flags = 0,
|
||||
reserved = 0,
|
||||
invoke = null,
|
||||
descriptor = xx @__sx_block_descriptor,
|
||||
sx_env = self.env,
|
||||
sx_fn = self.fn_ptr,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
main :: () -> s32 {
|
||||
cl := (a: s32, b: bool) => true;
|
||||
b : *Block = xx cl;
|
||||
print("pack impl match ok\n");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user