aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-01-16 13:22:37 +0000
committergingerBill <bill@gingerbill.org>2023-01-16 13:22:37 +0000
commit5d397804f7c02a2a71a10dd3af2f59a1bb3b4a10 (patch)
tree5a5d1e630d903f4335ceeb0557b4644974d71ccb /src
parenta5a7226885718e701665a7a5eb2528dcd2506f0a (diff)
Fix #2286 by printing an error correctly
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp3
-rw-r--r--src/check_type.cpp6
-rw-r--r--src/llvm_backend_proc.cpp4
3 files changed, 12 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 608eb879b..b4b36a950 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -4898,6 +4898,9 @@ gb_internal bool is_type_normal_pointer(Type *ptr, Type **elem) {
gb_internal bool is_type_valid_atomic_type(Type *elem) {
elem = core_type(elem);
+ if (is_type_internally_pointer_like(elem)) {
+ return true;
+ }
if (elem->kind == Type_BitSet) {
elem = bit_set_to_int(elem);
}
diff --git a/src/check_type.cpp b/src/check_type.cpp
index ad746514e..ec661134b 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1655,6 +1655,12 @@ gb_internal Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_para
} else if (!ctx->no_polymorphic_errors) {
// NOTE(bill): The type should be determined now and thus, no need to determine the type any more
is_type_polymorphic_type = false;
+ Entity *proc_entity = entity_from_expr(op.expr);
+ if ((proc_entity != nullptr) && (op.value.kind == ExactValue_Procedure)) {
+ if (is_type_polymorphic(proc_entity->type, false)) {
+ error(op.expr, "Cannot determine complete type of partial polymorphic procedure");
+ }
+ }
}
}
if (is_poly_name) {
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index b95fc7da6..822bae84e 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -68,7 +68,9 @@ gb_internal lbProcedure *lb_create_procedure(lbModule *m, Entity *entity, bool i
GB_ASSERT(entity != nullptr);
GB_ASSERT(entity->kind == Entity_Procedure);
if (!entity->Procedure.is_foreign) {
- GB_ASSERT_MSG(entity->flags & EntityFlag_ProcBodyChecked, "%.*s :: %s (was parapoly: %d)", LIT(entity->token.string), type_to_string(entity->type), is_type_polymorphic(entity->type, true));
+ if ((entity->flags & EntityFlag_ProcBodyChecked) == 0) {
+ GB_PANIC("%.*s :: %s (was parapoly: %d %d)", LIT(entity->token.string), type_to_string(entity->type), is_type_polymorphic(entity->type, true), is_type_polymorphic(entity->type, false));
+ }
}
String link_name = {};