| author | |
| committer | |
| log | 557d75d58a787ed0154e9bb2e58d26f9a5f9414e |
| tree | e2725b755bbcd63861b38fc22bab627483d774b8 |
| parent | 51682717d773aa4bdee89bc67cab08dc9b4bcc15 |
| parent | 010c58e3038ad9ca898b4c6e76877e4e7c43968f |
| signature | Signed by PGP key 4AEE18F83AFDEB23 |
Fix zig fmt out of bounds on empty file2 files changed, 8 insertions(+), 0 deletions(-)
lib/std/zig/parser_test.zig+6| ... | ... | @@ -223,6 +223,12 @@ test "recovery: missing block after for/while loops" { |
| 223 | 223 | }); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | test "zig fmt: empty file" { | |
| 227 | try testCanonical( | |
| 228 | \\ | |
| 229 | ); | |
| 230 | } | |
| 231 | ||
| 226 | 232 | test "zig fmt: if statment" { |
| 227 | 233 | try testCanonical( |
| 228 | 234 | \\test "" { |
lib/std/zig/render.zig+2| ... | ... | @@ -82,6 +82,8 @@ fn renderRoot( |
| 82 | 82 | var start_col: usize = 0; |
| 83 | 83 | var decl_i: ast.NodeIndex = 0; |
| 84 | 84 | const root_decls = tree.root_node.decls(); |
| 85 | ||
| 86 | if (root_decls.len == 0) return; | |
| 85 | 87 | while (true) { |
| 86 | 88 | var decl = root_decls[decl_i]; |
| 87 | 89 |