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.
This commit is contained in:
22
examples/errors/1033-errors-caller-location.sx
Normal file
22
examples/errors/1033-errors-caller-location.sx
Normal file
@@ -0,0 +1,22 @@
|
||||
// `#caller_location` (ERR step E4.1b). As a parameter's default value it
|
||||
// resolves to a `Source_Location` of the CALL site — file, line:col, and the
|
||||
// enclosing function — rather than the callee's signature. Explicitly
|
||||
// forwarding a `Source_Location` through an inner call preserves the outermost
|
||||
// site (so a logging wrapper reports where IT was called). Expected exit: 0.
|
||||
|
||||
#import "modules/std.sx";
|
||||
|
||||
note :: (loc: Source_Location = #caller_location) {
|
||||
print("note from {} (line {})\n", loc.func, loc.line);
|
||||
}
|
||||
|
||||
// Forwards its own caller location through to `note`.
|
||||
wrap :: (loc: Source_Location = #caller_location) {
|
||||
note(loc);
|
||||
}
|
||||
|
||||
main :: () -> i32 {
|
||||
note(); // call site → func main
|
||||
wrap(); // forwarded → still reports this line in main
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user