From b0b724d80e934e1e0cdbd98b280588180e678f4e Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Sat, 18 Jan 2025 18:32:13 +0000 Subject: [PATCH] Cleanup --- src/libponyc/expr/match.c | 12 ++++-------- src/libponyc/type/matchtype.c | 2 +- test/libponyc/badpony.cc | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/libponyc/expr/match.c b/src/libponyc/expr/match.c index 90a6bcd8f4..fca3472519 100644 --- a/src/libponyc/expr/match.c +++ b/src/libponyc/expr/match.c @@ -497,20 +497,16 @@ bool expr_case(pass_opt_t* opt, ast_t* ast) if(!infer_pattern_type(pattern, match_type, opt)) return false; - ast_t* declared_pattern_type = make_pattern_type(opt, pattern); - if(declared_pattern_type == NULL) - return false; - - ast_settype(ast, declared_pattern_type); - - ast_t* pattern_type = consume_type(declared_pattern_type, TK_NONE, false); + ast_t* pattern_type = make_pattern_type(opt, pattern); if(pattern_type == NULL) return false; + ast_settype(ast, pattern_type); + bool ok = true; errorframe_t info = NULL; - switch(is_matchtype(match_type, declared_pattern_type, &info, opt)) + switch(is_matchtype(match_type, pattern_type, &info, opt)) { case MATCHTYPE_ACCEPT: break; diff --git a/src/libponyc/type/matchtype.c b/src/libponyc/type/matchtype.c index 3a560f18b2..0f09b66c2c 100644 --- a/src/libponyc/type/matchtype.c +++ b/src/libponyc/type/matchtype.c @@ -944,7 +944,7 @@ matchtype_t is_matchtype(ast_t* operand, ast_t* pattern, errorframe_t* errorf, // TODO discuss with joe if (consumed_pattern != pattern) - ast_free_unattached(consumed_pattern); + ast_free_unattached(consumed_pattern); return rslt; } diff --git a/test/libponyc/badpony.cc b/test/libponyc/badpony.cc index 0b094e79b7..0067780068 100644 --- a/test/libponyc/badpony.cc +++ b/test/libponyc/badpony.cc @@ -1340,7 +1340,7 @@ TEST_F(BadPonyTest, MatchIsoLetWithoutConsume) " let a: String iso = recover iso String end\n" " match a\n" - " | let a': String => None\n" + " | let a': String iso => None\n" " end"; TEST_ERRORS_1(src, "this capture violates capabilities");