mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Currently, the compiler (like @typeName) writes it `fn(...) Type` but zig fmt writes it `fn (...) Type` (notice the space after `fn`). This inconsistency is now resolved and function types are consistently written the zig fmt way. Before this there were more `fn (...) Type` occurrences than `fn(...) Type` already.
17 lines
484 B
Zig
17 lines
484 B
Zig
pub export fn entry1() void {
|
|
const optional_fn: ?fn () void = null;
|
|
_ = optional_fn();
|
|
}
|
|
pub export fn entry2() void {
|
|
const optional_fn_ptr: ?*const fn () void = null;
|
|
_ = optional_fn_ptr();
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :3:9: error: cannot call optional type '?fn () void'
|
|
// :3:9: note: consider using '.?', 'orelse' or 'if'
|
|
// :7:9: error: cannot call optional type '?*const fn () void'
|
|
// :7:9: note: consider using '.?', 'orelse' or 'if'
|