From b9372668fe68f047fd3b33db450e65ca6e76fc45 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Mon, 22 May 2023 22:30:52 -0500 Subject: [PATCH] bugfix: parsing types and Result->unwrap --- compiler/src/parser.c | 6 ++++-- core/container/result.onyx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/src/parser.c b/compiler/src/parser.c index ecd261f8..441d0dad 100644 --- a/compiler/src/parser.c +++ b/compiler/src/parser.c @@ -1997,9 +1997,11 @@ static AstType* parse_type(OnyxParser* parser) { pc_type->params = params; *next_insertion = (AstType *) pc_type; - } else { - next_insertion = NULL; } + + if (peek_token(0)->type != '.') + next_insertion = NULL; + break; } diff --git a/core/container/result.onyx b/core/container/result.onyx index 2ef516d4..2ed9c51d 100644 --- a/core/container/result.onyx +++ b/core/container/result.onyx @@ -70,8 +70,8 @@ Result :: union (Ok_Type: type_expr, Err_Type: type_expr) { unwrap :: (r: #Self) -> r.Ok_Type { switch r { case .Ok => v do return v; - case #default { - msg := tprintf("Unwrapping Result with error '{}'.", r.__data.error); + case .Err => err { + msg := tprintf("Unwrapping Result with error '{}'.", err); assert(false, msg); return .{}; } -- 2.25.1