harec

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

commit 1a0162835046c8030c80164e6be032332be1d0c9
parent 36dab6cacf3823767ca35433cb177e25927138c5
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  5 Oct 2021 14:06:29 +0200

all: remove ENUM from types::builtin

Diffstat:
Minclude/types.h | 2+-
Mrt/types.ha | 4++--
Mtests/13-tagged.ha | 22+++++++++++-----------
Mtests/30-reduction.c | 2+-
Mtypes/reflect.ha | 4++--
5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/types.h b/include/types.h @@ -9,7 +9,6 @@ enum type_storage { // The order of these is important STORAGE_BOOL, STORAGE_CHAR, - STORAGE_ENUM, STORAGE_F32, STORAGE_F64, STORAGE_I16, @@ -32,6 +31,7 @@ enum type_storage { // Other types STORAGE_ALIAS, STORAGE_ARRAY, + STORAGE_ENUM, STORAGE_FUNCTION, STORAGE_POINTER, STORAGE_SLICE, diff --git a/rt/types.ha b/rt/types.ha @@ -29,8 +29,8 @@ type types::array = struct { }; type types::builtin = enum uint { - BOOL, CHAR, ENUM, F32, F64, I16, I32, I64, I8, INT, NULL, RUNE, SIZE, - STR, U16, U32, U64, U8, UINT, UINTPTR, VOID, TYPE, + BOOL, CHAR, F32, F64, I16, I32, I64, I8, INT, NULL, RUNE, SIZE, STR, + U16, U32, U64, U8, UINT, UINTPTR, VOID, TYPE, }; type types::enum_ = struct { diff --git a/tests/13-tagged.ha b/tests/13-tagged.ha @@ -20,19 +20,19 @@ fn storage() void = { tag: uint, union { _u8: u8, _u16: u16, _u32: u32, _u64: u64 }, }; - assert(y.tag == 1268499444); // u8 type ID + assert(y.tag == 1906196061); // u8 type ID assert(y._u8 == 42); x = 1337u16; - assert(y.tag == 4119164483); // u16 type ID + assert(y.tag == 2206074632); // u16 type ID assert(y._u16 == 1337); x = 0xCAFEBABEu32; - assert(y.tag == 3481467866); // u32 type ID + assert(y.tag == 4119164483); // u32 type ID assert(y._u32 == 0xCAFEBABE); x = 0xCAFEBABEDEADBEEFu64; - assert(y.tag == 1906196061); // u64 type ID + assert(y.tag == 3481467866); // u64 type ID assert(y._u64 == 0xCAFEBABEDEADBEEF); }; @@ -97,9 +97,9 @@ fn membercast() void = { id: uint, data: int, }; - assert(p.id == 3650376889); + assert(p.id == 2543892678); x = 1337; - assert(p.id == 461893804); + assert(p.id == 1099590421); assert(p.data == 1337); // Align of 4 @@ -111,10 +111,10 @@ fn membercast() void = { fdata: f32, }, }; - assert(p.id == 461893804); + assert(p.id == 1099590421); assert(p.data.idata == 1337); x = 13.37f32; - assert(p.id == 930681398); + assert(p.id == 1568378015); assert(p.data.fdata == 13.37f32); // Align of 8 @@ -123,7 +123,7 @@ fn membercast() void = { id: uint, data: size, }; - assert(p.id == 2843771249); + assert(p.id == 1737287038); assert(p.data == 1337z); }; @@ -138,7 +138,7 @@ fn subsetcast() void = { i: int, }, }; - assert(p.tag == 2843771249); + assert(p.tag == 1737287038); assert(p.data.z == 1337z); // Disjoint alignment @@ -151,7 +151,7 @@ fn subsetcast() void = { i: int, }, }; - assert(p.tag == 461893804); + assert(p.tag == 1099590421); assert(p.data.i == 1337); }; diff --git a/tests/30-reduction.c b/tests/30-reduction.c @@ -28,7 +28,7 @@ void test(struct context *ctx, char *expected, char *input) { FILE *ibuf = fmemopen(input, strlen(input), "r"); struct lexer ilex; - lex_init(&ilex, ibuf, "<input>"); + lex_init(&ilex, ibuf, input); struct ast_expression *iaexpr = parse_expression(&ilex); struct expression iexpr = {0}; check_expression(ctx, iaexpr, &iexpr, NULL); diff --git a/types/reflect.ha b/types/reflect.ha @@ -40,8 +40,8 @@ export type array = struct { // A built-in type. export type builtin = enum uint { - BOOL, CHAR, ENUM, F32, F64, I16, I32, I64, I8, INT, NULL, RUNE, SIZE, - STR, U16, U32, U64, U8, UINT, UINTPTR, VOID, TYPE, + BOOL, CHAR, F32, F64, I16, I32, I64, I8, INT, NULL, RUNE, SIZE, STR, + U16, U32, U64, U8, UINT, UINTPTR, VOID, TYPE, }; // An enum type.