mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
17 lines
503 B
Zig
17 lines
503 B
Zig
// This additionally tests that the compile error reports the correct source location.
|
|
// Without storing source locations relative to the owner decl, the compile error
|
|
// here would be off by 2 bytes (from the "7" -> "999").
|
|
pub fn main() void {
|
|
const y = fibonacci(999);
|
|
if (y - 21 != 0) unreachable;
|
|
}
|
|
|
|
inline fn fibonacci(n: usize) usize {
|
|
if (n <= 2) return n;
|
|
return fibonacci(n - 2) + fibonacci(n - 1);
|
|
}
|
|
|
|
// error
|
|
//
|
|
// :11:21: error: evaluation exceeded 1000 backwards branches
|