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.
24 lines
865 B
Plaintext
24 lines
865 B
Plaintext
// Call-site default-argument expansion (`appendDefaultArgs` / `expandCallDefaults`
|
|
// in lowerCall). A call that omits a trailing parameter with a default value
|
|
// has the default expression spliced in at the call site; an explicit argument
|
|
// overrides it. Two trailing defaults cover the "fill all remaining" path.
|
|
// Path-free IR (literal defaults) so the `.ir` snapshot is location-stable.
|
|
|
|
#import "modules/std.sx";
|
|
|
|
scale :: (n: i32, factor: i32 = 2) -> i32 { n * factor }
|
|
|
|
label :: (n: i32, prefix: string = "v", suffix: string = "!") -> i32 {
|
|
print("{}{}{}\n", prefix, n, suffix);
|
|
n
|
|
}
|
|
|
|
main :: () {
|
|
print("default: {}\n", scale(5));
|
|
print("explicit: {}\n", scale(5, 3));
|
|
|
|
_ = label(1); // both defaults filled
|
|
_ = label(2, "x"); // suffix default filled
|
|
_ = label(3, "y", "?"); // no defaults
|
|
}
|