From beb10d6e2dcda052b36291b8bb80195d2cb3b2f4 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sun, 12 Jun 2022 12:56:31 +0200 Subject: [PATCH] Typesafe type aliases, first draft 100 lines and not working, second draw 2 lines and working 100% --- typechecking.cpp | 1 + typechecking.h | 1 + 2 files changed, 2 insertions(+) diff --git a/typechecking.cpp b/typechecking.cpp index a92a6ce..53d481e 100644 --- a/typechecking.cpp +++ b/typechecking.cpp @@ -965,6 +965,7 @@ resolve_decl(Ast_Decl *ast){ node->value = op.value; if(op.value.type == type_type){ node->kind = AST_TYPE; + node->type_val = type_copy(pctx->perm, node->type_val); } else if(is_lambda(op.value.type)){ node->kind = AST_LAMBDA; } diff --git a/typechecking.h b/typechecking.h index cba0f8c..c5d65d2 100644 --- a/typechecking.h +++ b/typechecking.h @@ -126,6 +126,7 @@ type_pointer(Ast_Type *base){ if(!result){ result = type_new(pctx->perm, TYPE_POINTER, pointer_size, pointer_align); result->base = base; + result->is_unsigned = true; map_insert(&pctx->type_map, base, result); } assert(result->kind == TYPE_POINTER);