Change how abs, min, max, and clamp are implemented for floats

This commit is contained in:
gingerBill
2017-12-11 11:06:43 +00:00
parent 3c6f90e552
commit 3aea08df78
5 changed files with 88 additions and 84 deletions

View File

@@ -2527,8 +2527,7 @@ Entity *check_selector(Checker *c, Operand *operand, AstNode *node, Type *type_h
}
if (entity->kind == Entity_ProcGroup) {
auto *pge = &entity->ProcGroup;
Array<Entity *> procs = pge->entities;
Array<Entity *> procs = entity->ProcGroup.entities;
bool skip = false;
for_array(i, procs) {
Entity *p = procs[i];
@@ -5460,8 +5459,12 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
max = index;
}
if (t->kind == Type_Array && is_to_be_determined_array_count) {
t->Array.count = max;
if (t->kind == Type_Array) {
if (is_to_be_determined_array_count) {
t->Array.count = max;
} else if (0 < max && max < t->Array.count) {
error(node, "Expected %lld values for this array literal, got %lld", cast(long long)t->Array.count, cast(long long)max);
}
}
break;