From f515af8cd2ffb291788b3716a71c7ff5b0887e02 Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Mon, 20 May 2024 00:04:00 +0200 Subject: [PATCH] fix(parser): Would not allow error set on arrow function --- src/Parser.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Parser.zig b/src/Parser.zig index 07753ec7..05f2c3ba 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -5200,7 +5200,7 @@ fn function( const end_token: Token.Type = if (function_type.canOmitBody()) .Semicolon else .LeftBrace; - while (!self.check(end_token) and !self.check(.Eof)) { + while (!self.check(end_token) and !self.check(.Arrow) and !self.check(.Eof)) { const error_type_node = try self.parseTypeDef( self.ast.nodes.items(.type_def)[function_node].?.resolved_type.?.Function.generic_types, true, @@ -5214,7 +5214,7 @@ fn function( self.reportError(.error_type, "Error type can't be optional"); } - if (!self.check(end_token)) { + if (!self.check(end_token) and !self.check(.Arrow)) { try self.consume(.Comma, "Expected `,` after error type"); } }