diff --git a/build/rtsgame/main.core b/build/rtsgame/main.core index 31eec04..82e2ac9 100644 --- a/build/rtsgame/main.core +++ b/build/rtsgame/main.core @@ -1,6 +1,3 @@ - - - /*@language_refactor: Remove tuples and simplify, Make var unpacking general*/ /*@language_todo: make polymorphism checking more robust*/ @@ -25,24 +22,6 @@ thing := 1 :goto_block: for -@reproduction: -This kills the compiler due to referencing slice data - -Array :: struct($T: Type) - slice: []T - cap: S64 - -Guy :: struct - pos: Vector2 - -Add :: (a: *Array($T), item: T) - if a.cap == 0 - a.cap = 16 - a.slice.data = malloc(sizeof(T) * a.cap) - a.slice.data[a.slice.len++] = item - -guys: Array(Guy) -Add(&guys, {100, 100}) */ #import "raylib.core" diff --git a/core_typechecking.cpp b/core_typechecking.cpp index ee1db3d..9428056 100644 --- a/core_typechecking.cpp +++ b/core_typechecking.cpp @@ -1344,9 +1344,9 @@ resolve_expr(Ast_Expr *ast, Resolve_Flag flags, Ast_Type *compound_and_const_str if (is_pointer(type)) type = type->base; type_complete(type); - if (!type->ast) { - compiler_error(node->pos, "Builtin type %Q doesn't have anything to access using '.' operator", typestring(type)); - } + bool is_dottable_type = type->kind == TYPE_STRUCT || type->kind == TYPE_UNION; + if (is_dottable_type == false) compiler_error(node->pos, "Type %Q doesn't have anything to access using '.' operator", typestring(type)); + scope = ((Ast_Decl *)type->ast)->scope; if (!scope) { compiler_error(node->pos, "Internal compiler error? Type %Q doesn't have scope, you cannot use '.' on this variable", typestring(type));