Move examples/*.sx and their expected/ snapshots into per-category subfolders (examples/<category>/...). Folder = leading filename token, with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus runner and LSP sweep now discover each category's expected/ dir, while issues/ stays flat. Example 1058's repo-root-relative companion import is made file-relative. Path strings embedded in 164 snapshots were regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
40 lines
1.0 KiB
Plaintext
40 lines
1.0 KiB
Plaintext
// Struct with multiple `?f32` fields, all set to `null` simultaneously, passed
|
|
// into a protocol-dispatched method. Exercises the all-null-payload path through
|
|
// the boxed call.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
ProposedSize :: struct {
|
|
width: ?f32;
|
|
height: ?f32;
|
|
}
|
|
|
|
Sizable :: protocol {
|
|
size :: (self: *Self, proposal: ProposedSize) -> f32;
|
|
}
|
|
|
|
Widget :: struct {}
|
|
|
|
impl Sizable for Widget {
|
|
size :: (self: *Widget, proposal: ProposedSize) -> f32 {
|
|
w := if pw := proposal.width { pw } else { 100.0 };
|
|
h := if ph := proposal.height { ph } else { 100.0 };
|
|
w + h
|
|
}
|
|
}
|
|
|
|
main :: () -> void {
|
|
w := Widget.{};
|
|
s : Sizable = w;
|
|
|
|
// These work:
|
|
r1 := s.size(ProposedSize.{ width = 50.0, height = null });
|
|
print("r1 = {}\n", r1);
|
|
r2 := s.size(ProposedSize.{ width = null, height = 50.0 });
|
|
print("r2 = {}\n", r2);
|
|
|
|
// This fails with "scalar-to-vector conversion failed":
|
|
r3 := s.size(ProposedSize.{ width = null, height = null });
|
|
print("r3 = {}\n", r3);
|
|
}
|