commit d1e5d917b8d94fc0c8efe3eaffb28dd7fab38553
parent 0fc74e86b3ee2c559408a276f955b4c6f6cae0e3
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 24 Jan 2021 09:56:25 -0500
parse: fix parsing match against type alias
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/parse.c b/src/parse.c
@@ -1733,10 +1733,10 @@ parse_match_expression(struct lexer *lexer)
_case->type->alias = ident;
break;
case T_CASE:
- unlex(lexer, &tok);
- _case->type = parse_type(lexer);
- assert(_case->type->storage == TYPE_STORAGE_ALIAS);
unlex(lexer, &tok2);
+ _case->type = mktype(&tok.loc);
+ _case->type->storage = TYPE_STORAGE_ALIAS;
+ _case->type->alias.name = tok.name;
break;
default:
synassert(false, &tok, T_COLON,
diff --git a/tests/18-match.ha b/tests/18-match.ha
@@ -24,8 +24,8 @@ fn termination() void = {
fn default() void = {
let x: (int | uint | str) = 1337u;
let y: int = match (x) {
- int => 42,
- * => 24,
+ int => 42,
+ * => 24,
};
assert(y == 24);
};