harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 2f5917555ce38030b15a566afa7e5124fb07a70a
parent af65c5601d32f88b513136490d1d678e52c80c6f
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Tue, 23 Feb 2021 14:40:21 -0500

Handle lowering non-float constants to float

Fixes `fmt::printf("{}", 1234);`. Actually implementing float constant
lowering can wait until we have float constants.

Diffstat:
Msrc/check.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -990,9 +990,6 @@ lower_constant(const struct type *type, struct expression *expr) { assert(expr->type == EXPR_CONSTANT); type = type_dealias(type); - if (type_is_float(type)) { - assert(0); // TODO - } if (type->storage == STORAGE_TAGGED) { const struct type *tag = NULL; for (const struct type_tagged_union *tu = &type->tagged; tu; @@ -1008,6 +1005,9 @@ lower_constant(const struct type *type, struct expression *expr) } return tag; } + if (type_is_float(type) && type_is_float(expr->result)) { + assert(0); // TODO + } if (!type_is_integer(type)) { return NULL; }