From df3690c32a4e988bcce5e3b5d6b338a801ed1518 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 26 Aug 2020 22:46:54 +0100 Subject: Revert accidental removal of `#const` for procedure variable parameters #718 --- src/check_type.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index fe76d65d5..32309ce26 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1662,6 +1662,10 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is error(name, "'auto_cast' can only be applied to variable fields"); p->flags &= ~FieldFlag_auto_cast; } + if (p->flags&FieldFlag_const) { + error(name, "'#const' can only be applied to variable fields"); + p->flags &= ~FieldFlag_const; + } param = alloc_entity_type_name(scope, name->Ident.token, type, EntityState_Resolved); param->TypeName.is_type_alias = true; @@ -1726,6 +1730,10 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is error(name, "'auto_cast' can only be applied to variable fields"); p->flags &= ~FieldFlag_auto_cast; } + if (p->flags&FieldFlag_const) { + error(name, "'#const' can only be applied to variable fields"); + p->flags &= ~FieldFlag_const; + } if (!is_type_constant_type(type) && !is_type_polymorphic(type)) { gbString str = type_to_string(type); @@ -1745,6 +1753,9 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is if (p->flags&FieldFlag_auto_cast) { param->flags |= EntityFlag_AutoCast; } + if (p->flags&FieldFlag_const) { + param->flags |= EntityFlag_ConstInput; + } param->state = EntityState_Resolved; // NOTE(bill): This should have be resolved whilst determining it add_entity(ctx->checker, scope, name, param); -- cgit v1.2.3 From d31c63c0ae76115d1b9aa8b5d1f8bf7130e74977 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 27 Aug 2020 00:11:02 +0100 Subject: Fix #714 --- src/check_type.cpp | 2 +- src/types.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 32309ce26..7be70c11d 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1137,7 +1137,7 @@ void check_bit_set_type(CheckerContext *c, Type *type, Type *named_type, Ast *no } else { Type *elem = check_type_expr(c, bs->elem, nullptr); - #if 1 + #if 0 if (named_type != nullptr && named_type->kind == Type_Named && elem->kind == Type_Enum) { // NOTE(bill): Anonymous enumeration diff --git a/src/types.cpp b/src/types.cpp index 4372bdd6a..453540252 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -877,6 +877,9 @@ Type *alloc_type_named(String name, Type *base, Entity *type_name) { Type *t = alloc_type(Type_Named); t->Named.name = name; t->Named.base = base; + if (base != t) { + t->Named.base = base_type(base); + } t->Named.type_name = type_name; return t; } -- cgit v1.2.3