Files
sx/examples/diagnostics/1167-diagnostics-call-arity-mismatch.sx
agra 66bdc70bf1 test: group examples into per-category folders
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.
2026-06-21 14:41:34 +03:00

27 lines
917 B
Plaintext

// Wrong argument counts to fixed-arity functions are rejected at the call
// site — bare calls, flat-imported stdlib fns, method dot-calls, and ufcs
// dot-calls — instead of reaching LLVM verification ("Incorrect number of
// arguments passed to called function!").
// Regression (issue 0123).
#import "modules/std.sx";
add2 :: (a: i64, b: i64) -> i64 { return a + b; }
Point :: struct {
x: i64;
scaled :: (self: Point, k: i64) -> i64 { return self.x * k; }
}
bump :: ufcs (p: Point, by: i64) -> i64 { return p.x + by; }
main :: () -> i32 {
_ = add2(1, 2, 3); // plain bare call, too many
_ = add2(1); // plain bare call, too few
_ = concat("a", "b", "c"); // flat-imported stdlib fn, too many
p := Point.{ x = 5 };
_ = p.scaled(2, 9); // method dot-call, too many
_ = p.bump(1, 2); // ufcs dot-call, too many
return 0;
}