diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 78f200a21..2e1663f98 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6130,7 +6130,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type case_end; case Ast_TypeidType: - case Ast_TypeType: case Ast_PolyType: case Ast_ProcType: case Ast_PointerType: @@ -6573,14 +6572,6 @@ gbString write_expr_to_string(gbString str, Ast *node) { str = gb_string_appendc(str, ")"); case_end; - case_ast_node(tt, TypeType, node); - str = gb_string_appendc(str, "type"); - if (tt->specialization) { - str = gb_string_appendc(str, "/"); - str = write_expr_to_string(str, tt->specialization); - } - case_end; - case_ast_node(tt, TypeidType, node); str = gb_string_appendc(str, "typeid"); if (tt->specialization) { diff --git a/src/check_type.cpp b/src/check_type.cpp index 63c05ee7c..9704db081 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -382,14 +382,6 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *node, Array< specialization = check_type(ctx, s); } type = alloc_type_generic(ctx->scope, 0, str_lit(""), specialization); - } else if (type_expr->kind == Ast_TypeType) { - is_type_param = true; - Type *specialization = nullptr; - if (type_expr->TypeType.specialization != nullptr) { - Ast *s = type_expr->TypeType.specialization; - specialization = check_type(ctx, s); - } - type = alloc_type_generic(ctx->scope, 0, str_lit(""), specialization); } else { type = check_type(ctx, type_expr); if (is_type_polymorphic(type)) { @@ -574,14 +566,6 @@ void check_union_type(CheckerContext *ctx, Type *union_type, Ast *node, Arrayscope, 0, str_lit(""), specialization); - } else if (type_expr->kind == Ast_TypeType) { - is_type_param = true; - Type *specialization = nullptr; - if (type_expr->TypeType.specialization != nullptr) { - Ast *s = type_expr->TypeType.specialization; - specialization = check_type(ctx, s); - } - type = alloc_type_generic(ctx->scope, 0, str_lit(""), specialization); } else { type = check_type(ctx, type_expr); if (is_type_polymorphic(type)) { @@ -1383,20 +1367,6 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is } else { type = t_typeid; } - } else if (type_expr->kind == Ast_TypeType) { - ast_node(tt, TypeType, type_expr); - is_type_param = true; - specialization = check_type(ctx, tt->specialization); - if (specialization == t_invalid){ - specialization = nullptr; - } - - if (operands != nullptr) { - detemine_type_from_operand = true; - type = t_invalid; - } else { - type = alloc_type_generic(ctx->scope, 0, str_lit(""), specialization); - } } else { bool prev = ctx->allow_polymorphic_types; if (operands != nullptr) { @@ -1412,7 +1382,7 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is } if (default_value != nullptr) { - if (type_expr != nullptr && (type_expr->kind == Ast_TypeType || type_expr->kind == Ast_TypeidType)) { + if (type_expr != nullptr && type_expr->kind == Ast_TypeidType) { error(type_expr, "A type parameter may not have a default value"); } else { param_value = handle_parameter_value(ctx, type, nullptr, default_value, true); diff --git a/src/checker.cpp b/src/checker.cpp index 97f7bf4e8..61910f959 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -2150,8 +2150,7 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) { d->attributes = vd->attributes; - if (is_ast_type(init) || - (vd->type != nullptr && vd->type->kind == Ast_TypeType)) { + if (is_ast_type(init)) { e = alloc_entity_type_name(d->scope, token, nullptr); if (vd->type != nullptr) { error(name, "A type declaration cannot have an type parameter"); diff --git a/src/parser.cpp b/src/parser.cpp index 8bbdc2ebc..4a563c086 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -77,7 +77,6 @@ Token ast_token(Ast *node) { case Ast_UnionField: return ast_token(node->UnionField.name); - case Ast_TypeType: return node->TypeType.token; case Ast_TypeidType: return node->TypeidType.token; case Ast_HelperType: return node->HelperType.token; case Ast_DistinctType: return node->DistinctType.token; @@ -314,9 +313,6 @@ Ast *clone_ast(Ast *node) { case Ast_TypeidType: n->TypeidType.specialization = clone_ast(n->TypeidType.specialization); break; - case Ast_TypeType: - n->TypeType.specialization = clone_ast(n->TypeType.specialization); - break; case Ast_HelperType: n->HelperType.type = clone_ast(n->HelperType.type); break; @@ -839,13 +835,6 @@ Ast *ast_typeid_type(AstFile *f, Token token, Ast *specialization) { return result; } -Ast *ast_type_type(AstFile *f, Token token, Ast *specialization) { - Ast *result = alloc_ast_node(f, Ast_TypeType); - result->TypeType.token = token; - result->TypeType.specialization = specialization; - return result; -} - Ast *ast_helper_type(AstFile *f, Token token, Ast *type) { Ast *result = alloc_ast_node(f, Ast_HelperType); result->HelperType.token = token; @@ -2740,8 +2729,7 @@ Ast *parse_proc_type(AstFile *f, Token proc_token) { Ast *param = params->FieldList.list[i]; ast_node(field, Field, param); if (field->type != nullptr) { - if (field->type->kind == Ast_TypeType || - field->type->kind == Ast_PolyType) { + if (field->type->kind == Ast_PolyType) { is_generic = true; goto end; } diff --git a/src/parser.hpp b/src/parser.hpp index 4409f0e74..4f0b4d260 100644 --- a/src/parser.hpp +++ b/src/parser.hpp @@ -423,10 +423,6 @@ AST_KIND(_TypeBegin, "", bool) \ Token token; \ Ast *specialization; \ }) \ - AST_KIND(TypeType, "type", struct { \ - Token token; \ - Ast *specialization; \ - }) \ AST_KIND(HelperType, "helper type", struct { \ Token token; \ Ast *type; \