diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-08 14:10:19 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-08 14:10:19 -0500 |
| commit | 5d35f286336878a3529dabdb3f7800b6f84712eb (patch) | |
| tree | ee21c66d28027e84fd31080c145978fba18fec89 /typecheck.c | |
| parent | 9c842201f312edd483ee99dcf3e321bdac2a7073 (diff) | |
Improve reductions so they work better nested and also have bespoke code
optimized for min/max and argmin/argmax.
Diffstat (limited to 'typecheck.c')
| -rw-r--r-- | typecheck.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/typecheck.c b/typecheck.c index 49eba2ca..a000393e 100644 --- a/typecheck.c +++ b/typecheck.c @@ -1019,11 +1019,9 @@ type_t *get_type(env_t *env, ast_t *ast) auto reduction = Match(ast, Reduction); type_t *iter_t = get_type(env, reduction->iter); - if (reduction->combination && reduction->combination->tag == BinaryOp) { - binop_e op = Match(reduction->combination, BinaryOp)->op; - if (op == BINOP_EQ || op == BINOP_NE || op == BINOP_LT || op == BINOP_LE || op == BINOP_GT || op == BINOP_GE) - return Type(OptionalType, .type=Type(BoolType)); - } + if (reduction->op == BINOP_EQ || reduction->op == BINOP_NE || reduction->op == BINOP_LT + || reduction->op == BINOP_LE || reduction->op == BINOP_GT || reduction->op == BINOP_GE) + return Type(OptionalType, .type=Type(BoolType)); type_t *iterated = get_iterated_type(iter_t); if (!iterated) |
