Commit 3458fb891d

Vexu <git@vexu.eu>
2020-02-24 22:21:11
remove `@typeId`, `@memberCount`, `@memberName` and `@memberType` from the compiler
1 parent 45da72c
doc/langref.html.in
@@ -2810,14 +2810,10 @@ test "@TagType" {
     assert(@TagType(Small) == u2);
 }
 
-// @memberCount tells how many fields an enum has:
-test "@memberCount" {
-    assert(@memberCount(Small) == 4);
-}
-
-// @memberName tells the name of a field in an enum:
-test "@memberName" {
-    assert(mem.eql(u8, @memberName(Small, 1), "Two"));
+// @typeInfo tells us the field count and the fields name:
+test "@typeInfo" {
+    assert(@typeInfo(Small).Enum.fields.len == 4);
+    assert(mem.eql(u8, @typeInfo(Small).Enum.fields[0].name, "Two"));
 }
 
 // @tagName gives a []const u8 representation of an enum value:
@@ -2825,7 +2821,7 @@ test "@tagName" {
     assert(mem.eql(u8, @tagName(Small.Three), "Three"));
 }
       {#code_end#}
-      {#see_also|@memberName|@memberCount|@tagName|@sizeOf#}
+      {#see_also|@typeInfo|@tagName|@sizeOf#}
 
       {#header_open|extern enum#}
       <p>
@@ -6816,7 +6812,7 @@ async fn func(y: *i32) void {
       Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.
       </p>
       <p>
-      Asserts that {#syntax#}@typeId(DestType) != @import("builtin").TypeId.Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@intToPtr{#endsyntax#} if you need this.
+      Asserts that {#syntax#}@typeInfo(DestType) != .Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@intToPtr{#endsyntax#} if you need this.
       </p>
       <p>
       Can be used for these things for example:
@@ -7269,7 +7265,7 @@ test "main" {
       <p>
       Floored division. Rounds toward negative infinity. For unsigned integers it is
       the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
-              {#syntax#}!(@typeId(T) == builtin.TypeId.Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
+              {#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
       </p>
       <ul>
           <li>{#syntax#}@divFloor(-5, 3) == -2{#endsyntax#}</li>
@@ -7283,7 +7279,7 @@ test "main" {
       <p>
       Truncated division. Rounds toward zero. For unsigned integers it is
       the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
-              {#syntax#}!(@typeId(T) == builtin.TypeId.Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
+              {#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
       </p>
       <ul>
           <li>{#syntax#}@divTrunc(-5, 3) == -1{#endsyntax#}</li>
@@ -7679,33 +7675,6 @@ test "@hasDecl" {
       </p>
       {#header_close#}
 
-      {#header_open|@memberCount#}
-      <pre>{#syntax#}@memberCount(comptime T: type) comptime_int{#endsyntax#}</pre>
-      <p>
-      This function returns the number of members in a struct, enum, or union type.
-      </p>
-      <p>
-      The result is a compile time constant.
-      </p>
-      <p>
-      It does not include functions, variables, or constants.
-      </p>
-      {#header_close#}
-      {#header_open|@memberName#}
-      <pre>{#syntax#}@memberName(comptime T: type, comptime index: usize) [N]u8{#endsyntax#}</pre>
-      <p>Returns the field name of a struct, union, or enum.</p>
-      <p>
-      The result is a compile time constant.
-      </p>
-      <p>
-      It does not include functions, variables, or constants.
-      </p>
-      {#header_close#}
-      {#header_open|@memberType#}
-      <pre>{#syntax#}@memberType(comptime T: type, comptime index: usize) type{#endsyntax#}</pre>
-      <p>Returns the field type of a struct or union.</p>
-      {#header_close#}
-
       {#header_open|@memcpy#}
       <pre>{#syntax#}@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize){#endsyntax#}</pre>
       <p>
@@ -8401,43 +8370,6 @@ test "integer truncation" {
           <li>{#link|struct#}</li>
       </ul>
       {#header_close#}
-
-      {#header_open|@typeId#}
-      <pre>{#syntax#}@typeId(comptime T: type) @import("builtin").TypeId{#endsyntax#}</pre>
-      <p>
-      Returns which kind of type something is. Possible values:
-      </p>
-      {#code_begin|syntax#}
-pub const TypeId = enum {
-    Type,
-    Void,
-    Bool,
-    NoReturn,
-    Int,
-    Float,
-    Pointer,
-    Array,
-    Struct,
-    ComptimeFloat,
-    ComptimeInt,
-    Undefined,
-    Null,
-    Optional,
-    ErrorUnion,
-    ErrorSet,
-    Enum,
-    Union,
-    Fn,
-    BoundFn,
-    Opaque,
-    Frame,
-    AnyFrame,
-    Vector,
-    EnumLiteral,
-};
-      {#code_end#}
-      {#header_close#}
-
       {#header_open|@typeInfo#}
       <pre>{#syntax#}@typeInfo(comptime T: type) @import("std").builtin.TypeInfo{#endsyntax#}</pre>
       <p>
src/all_types.hpp
@@ -1695,9 +1695,6 @@ enum BuiltinFnId {
     BuiltinFnIdMemset,
     BuiltinFnIdSizeof,
     BuiltinFnIdAlignOf,
-    BuiltinFnIdMemberCount,
-    BuiltinFnIdMemberType,
-    BuiltinFnIdMemberName,
     BuiltinFnIdField,
     BuiltinFnIdTypeInfo,
     BuiltinFnIdType,
@@ -1777,7 +1774,6 @@ enum BuiltinFnId {
     BuiltinFnIdBitOffsetOf,
     BuiltinFnIdNewStackCall,
     BuiltinFnIdAsyncCall,
-    BuiltinFnIdTypeId,
     BuiltinFnIdShlExact,
     BuiltinFnIdShrExact,
     BuiltinFnIdSetEvalBranchQuota,
@@ -2638,9 +2634,6 @@ enum IrInstSrcId {
     IrInstSrcIdMemset,
     IrInstSrcIdMemcpy,
     IrInstSrcIdSlice,
-    IrInstSrcIdMemberCount,
-    IrInstSrcIdMemberType,
-    IrInstSrcIdMemberName,
     IrInstSrcIdBreakpoint,
     IrInstSrcIdReturnAddress,
     IrInstSrcIdFrameAddress,
@@ -2677,7 +2670,6 @@ enum IrInstSrcId {
     IrInstSrcIdTypeInfo,
     IrInstSrcIdType,
     IrInstSrcIdHasField,
-    IrInstSrcIdTypeId,
     IrInstSrcIdSetEvalBranchQuota,
     IrInstSrcIdPtrType,
     IrInstSrcIdAlignCast,
@@ -3715,26 +3707,6 @@ struct IrInstGenSlice {
     bool safety_check_on;
 };
 
-struct IrInstSrcMemberCount {
-    IrInstSrc base;
-
-    IrInstSrc *container;
-};
-
-struct IrInstSrcMemberType {
-    IrInstSrc base;
-
-    IrInstSrc *container_type;
-    IrInstSrc *member_index;
-};
-
-struct IrInstSrcMemberName {
-    IrInstSrc base;
-
-    IrInstSrc *container_type;
-    IrInstSrc *member_index;
-};
-
 struct IrInstSrcBreakpoint {
     IrInstSrc base;
 };
@@ -4142,12 +4114,6 @@ struct IrInstSrcHasField {
     IrInstSrc *field_name;
 };
 
-struct IrInstSrcTypeId {
-    IrInstSrc base;
-
-    IrInstSrc *type_value;
-};
-
 struct IrInstSrcSetEvalBranchQuota {
     IrInstSrc base;
 
src/codegen.cpp
@@ -8152,9 +8152,6 @@ static void define_builtin_fns(CodeGen *g) {
     create_builtin_fn(g, BuiltinFnIdMemset, "memset", 3);
     create_builtin_fn(g, BuiltinFnIdSizeof, "sizeOf", 1);
     create_builtin_fn(g, BuiltinFnIdAlignOf, "alignOf", 1);
-    create_builtin_fn(g, BuiltinFnIdMemberCount, "memberCount", 1);
-    create_builtin_fn(g, BuiltinFnIdMemberType, "memberType", 2);
-    create_builtin_fn(g, BuiltinFnIdMemberName, "memberName", 2);
     create_builtin_fn(g, BuiltinFnIdField, "field", 2);
     create_builtin_fn(g, BuiltinFnIdTypeInfo, "typeInfo", 1);
     create_builtin_fn(g, BuiltinFnIdType, "Type", 1);
@@ -8231,7 +8228,6 @@ static void define_builtin_fns(CodeGen *g) {
     create_builtin_fn(g, BuiltinFnIdMulAdd, "mulAdd", 4);
     create_builtin_fn(g, BuiltinFnIdNewStackCall, "newStackCall", SIZE_MAX);
     create_builtin_fn(g, BuiltinFnIdAsyncCall, "asyncCall", SIZE_MAX);
-    create_builtin_fn(g, BuiltinFnIdTypeId, "typeId", 1);
     create_builtin_fn(g, BuiltinFnIdShlExact, "shlExact", 2);
     create_builtin_fn(g, BuiltinFnIdShrExact, "shrExact", 2);
     create_builtin_fn(g, BuiltinFnIdSetEvalBranchQuota, "setEvalBranchQuota", 1);
src/ir.cpp
@@ -405,12 +405,6 @@ static void destroy_instruction_src(IrInstSrc *inst) {
             return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemcpy *>(inst));
         case IrInstSrcIdSlice:
             return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSlice *>(inst));
-        case IrInstSrcIdMemberCount:
-            return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemberCount *>(inst));
-        case IrInstSrcIdMemberType:
-            return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemberType *>(inst));
-        case IrInstSrcIdMemberName:
-            return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcMemberName *>(inst));
         case IrInstSrcIdBreakpoint:
             return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcBreakpoint *>(inst));
         case IrInstSrcIdReturnAddress:
@@ -477,8 +471,6 @@ static void destroy_instruction_src(IrInstSrc *inst) {
             return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcType *>(inst));
         case IrInstSrcIdHasField:
             return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcHasField *>(inst));
-        case IrInstSrcIdTypeId:
-            return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcTypeId *>(inst));
         case IrInstSrcIdSetEvalBranchQuota:
             return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetEvalBranchQuota *>(inst));
         case IrInstSrcIdAlignCast:
@@ -1325,18 +1317,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcSlice *) {
     return IrInstSrcIdSlice;
 }
 
-static constexpr IrInstSrcId ir_inst_id(IrInstSrcMemberCount *) {
-    return IrInstSrcIdMemberCount;
-}
-
-static constexpr IrInstSrcId ir_inst_id(IrInstSrcMemberType *) {
-    return IrInstSrcIdMemberType;
-}
-
-static constexpr IrInstSrcId ir_inst_id(IrInstSrcMemberName *) {
-    return IrInstSrcIdMemberName;
-}
-
 static constexpr IrInstSrcId ir_inst_id(IrInstSrcBreakpoint *) {
     return IrInstSrcIdBreakpoint;
 }
@@ -1481,10 +1461,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcHasField *) {
     return IrInstSrcIdHasField;
 }
 
-static constexpr IrInstSrcId ir_inst_id(IrInstSrcTypeId *) {
-    return IrInstSrcIdTypeId;
-}
-
 static constexpr IrInstSrcId ir_inst_id(IrInstSrcSetEvalBranchQuota *) {
     return IrInstSrcIdSetEvalBranchQuota;
 }
@@ -3749,41 +3725,6 @@ static IrInstGen *ir_build_slice_gen(IrAnalyze *ira, IrInst *source_instruction,
     return &instruction->base;
 }
 
-static IrInstSrc *ir_build_member_count(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, IrInstSrc *container) {
-    IrInstSrcMemberCount *instruction = ir_build_instruction<IrInstSrcMemberCount>(irb, scope, source_node);
-    instruction->container = container;
-
-    ir_ref_instruction(container, irb->current_basic_block);
-
-    return &instruction->base;
-}
-
-static IrInstSrc *ir_build_member_type(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
-        IrInstSrc *container_type, IrInstSrc *member_index)
-{
-    IrInstSrcMemberType *instruction = ir_build_instruction<IrInstSrcMemberType>(irb, scope, source_node);
-    instruction->container_type = container_type;
-    instruction->member_index = member_index;
-
-    ir_ref_instruction(container_type, irb->current_basic_block);
-    ir_ref_instruction(member_index, irb->current_basic_block);
-
-    return &instruction->base;
-}
-
-static IrInstSrc *ir_build_member_name(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
-        IrInstSrc *container_type, IrInstSrc *member_index)
-{
-    IrInstSrcMemberName *instruction = ir_build_instruction<IrInstSrcMemberName>(irb, scope, source_node);
-    instruction->container_type = container_type;
-    instruction->member_index = member_index;
-
-    ir_ref_instruction(container_type, irb->current_basic_block);
-    ir_ref_instruction(member_index, irb->current_basic_block);
-
-    return &instruction->base;
-}
-
 static IrInstSrc *ir_build_breakpoint(IrBuilderSrc *irb, Scope *scope, AstNode *source_node) {
     IrInstSrcBreakpoint *instruction = ir_build_instruction<IrInstSrcBreakpoint>(irb, scope, source_node);
     return &instruction->base;
@@ -4458,15 +4399,6 @@ static IrInstSrc *ir_build_type(IrBuilderSrc *irb, Scope *scope, AstNode *source
     return &instruction->base;
 }
 
-static IrInstSrc *ir_build_type_id(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, IrInstSrc *type_value) {
-    IrInstSrcTypeId *instruction = ir_build_instruction<IrInstSrcTypeId>(irb, scope, source_node);
-    instruction->type_value = type_value;
-
-    ir_ref_instruction(type_value, irb->current_basic_block);
-
-    return &instruction->base;
-}
-
 static IrInstSrc *ir_build_set_eval_branch_quota(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
         IrInstSrc *new_quota)
 {
@@ -6710,48 +6642,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod
                 IrInstSrc *ir_memset = ir_build_memset_src(irb, scope, node, arg0_value, arg1_value, arg2_value);
                 return ir_lval_wrap(irb, scope, ir_memset, lval, result_loc);
             }
-        case BuiltinFnIdMemberCount:
-            {
-                AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
-                IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
-                if (arg0_value == irb->codegen->invalid_inst_src)
-                    return arg0_value;
-
-                IrInstSrc *member_count = ir_build_member_count(irb, scope, node, arg0_value);
-                return ir_lval_wrap(irb, scope, member_count, lval, result_loc);
-            }
-        case BuiltinFnIdMemberType:
-            {
-                AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
-                IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
-                if (arg0_value == irb->codegen->invalid_inst_src)
-                    return arg0_value;
-
-                AstNode *arg1_node = node->data.fn_call_expr.params.at(1);
-                IrInstSrc *arg1_value = ir_gen_node(irb, arg1_node, scope);
-                if (arg1_value == irb->codegen->invalid_inst_src)
-                    return arg1_value;
-
-
-                IrInstSrc *member_type = ir_build_member_type(irb, scope, node, arg0_value, arg1_value);
-                return ir_lval_wrap(irb, scope, member_type, lval, result_loc);
-            }
-        case BuiltinFnIdMemberName:
-            {
-                AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
-                IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
-                if (arg0_value == irb->codegen->invalid_inst_src)
-                    return arg0_value;
-
-                AstNode *arg1_node = node->data.fn_call_expr.params.at(1);
-                IrInstSrc *arg1_value = ir_gen_node(irb, arg1_node, scope);
-                if (arg1_value == irb->codegen->invalid_inst_src)
-                    return arg1_value;
-
-
-                IrInstSrc *member_name = ir_build_member_name(irb, scope, node, arg0_value, arg1_value);
-                return ir_lval_wrap(irb, scope, member_name, lval, result_loc);
-            }
         case BuiltinFnIdField:
             {
                 AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
@@ -7109,16 +6999,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod
         }
         case BuiltinFnIdAsyncCall:
             return ir_gen_async_call(irb, scope, nullptr, node, lval, result_loc);
-        case BuiltinFnIdTypeId:
-            {
-                AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
-                IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
-                if (arg0_value == irb->codegen->invalid_inst_src)
-                    return arg0_value;
-
-                IrInstSrc *type_id = ir_build_type_id(irb, scope, node, arg0_value);
-                return ir_lval_wrap(irb, scope, type_id, lval, result_loc);
-            }
         case BuiltinFnIdShlExact:
             {
                 AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
@@ -24795,19 +24675,6 @@ static IrInstGen *ir_analyze_instruction_type(IrAnalyze *ira, IrInstSrcType *ins
     return ir_const_type(ira, &instruction->base.base, type);
 }
 
-static IrInstGen *ir_analyze_instruction_type_id(IrAnalyze *ira, IrInstSrcTypeId *instruction) {
-    IrInstGen *type_value = instruction->type_value->child;
-    ZigType *type_entry = ir_resolve_type(ira, type_value);
-    if (type_is_invalid(type_entry))
-        return ira->codegen->invalid_inst_gen;
-
-    ZigType *result_type = get_builtin_type(ira->codegen, "TypeId");
-
-    IrInstGen *result = ir_const(ira, &instruction->base.base, result_type);
-    bigint_init_unsigned(&result->value->data.x_enum_tag, type_id_index(type_entry));
-    return result;
-}
-
 static IrInstGen *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira,
         IrInstSrcSetEvalBranchQuota *instruction)
 {
@@ -26445,143 +26312,6 @@ static IrInstGen *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstSrcSlice *i
         ptr_ptr, casted_start, end, instruction->safety_check_on, result_loc);
 }
 
-static IrInstGen *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstSrcMemberCount *instruction) {
-    Error err;
-    IrInstGen *container = instruction->container->child;
-    if (type_is_invalid(container->value->type))
-        return ira->codegen->invalid_inst_gen;
-    ZigType *container_type = ir_resolve_type(ira, container);
-
-    if ((err = type_resolve(ira->codegen, container_type, ResolveStatusSizeKnown)))
-        return ira->codegen->invalid_inst_gen;
-
-    uint64_t result;
-    if (type_is_invalid(container_type)) {
-        return ira->codegen->invalid_inst_gen;
-    } else if (container_type->id == ZigTypeIdEnum) {
-        result = container_type->data.enumeration.src_field_count;
-    } else if (container_type->id == ZigTypeIdStruct) {
-        result = container_type->data.structure.src_field_count;
-    } else if (container_type->id == ZigTypeIdUnion) {
-        result = container_type->data.unionation.src_field_count;
-    } else if (container_type->id == ZigTypeIdErrorSet) {
-        if (!resolve_inferred_error_set(ira->codegen, container_type, instruction->base.base.source_node)) {
-            return ira->codegen->invalid_inst_gen;
-        }
-        if (type_is_global_error_set(container_type)) {
-            ir_add_error(ira, &instruction->base.base, buf_sprintf("global error set member count not available at comptime"));
-            return ira->codegen->invalid_inst_gen;
-        }
-        result = container_type->data.error_set.err_count;
-    } else {
-        ir_add_error(ira, &instruction->base.base, buf_sprintf("no value count available for type '%s'", buf_ptr(&container_type->name)));
-        return ira->codegen->invalid_inst_gen;
-    }
-
-    return ir_const_unsigned(ira, &instruction->base.base, result);
-}
-
-static IrInstGen *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstSrcMemberType *instruction) {
-    Error err;
-    IrInstGen *container_type_value = instruction->container_type->child;
-    ZigType *container_type = ir_resolve_type(ira, container_type_value);
-    if (type_is_invalid(container_type))
-        return ira->codegen->invalid_inst_gen;
-
-    if ((err = type_resolve(ira->codegen, container_type, ResolveStatusSizeKnown)))
-        return ira->codegen->invalid_inst_gen;
-
-
-    uint64_t member_index;
-    IrInstGen *index_value = instruction->member_index->child;
-    if (!ir_resolve_usize(ira, index_value, &member_index))
-        return ira->codegen->invalid_inst_gen;
-
-    if (container_type->id == ZigTypeIdStruct) {
-        if (member_index >= container_type->data.structure.src_field_count) {
-            ir_add_error(ira, &index_value->base,
-                buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
-                    member_index, buf_ptr(&container_type->name), container_type->data.structure.src_field_count));
-            return ira->codegen->invalid_inst_gen;
-        }
-        TypeStructField *field = container_type->data.structure.fields[member_index];
-
-        return ir_const_type(ira, &instruction->base.base, field->type_entry);
-    } else if (container_type->id == ZigTypeIdUnion) {
-        if (member_index >= container_type->data.unionation.src_field_count) {
-            ir_add_error(ira, &index_value->base,
-                buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
-                    member_index, buf_ptr(&container_type->name), container_type->data.unionation.src_field_count));
-            return ira->codegen->invalid_inst_gen;
-        }
-        TypeUnionField *field = &container_type->data.unionation.fields[member_index];
-
-        return ir_const_type(ira, &instruction->base.base, field->type_entry);
-    } else {
-        ir_add_error(ira, &container_type_value->base,
-            buf_sprintf("type '%s' does not support @memberType", buf_ptr(&container_type->name)));
-        return ira->codegen->invalid_inst_gen;
-    }
-}
-
-static IrInstGen *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstSrcMemberName *instruction) {
-    Error err;
-    IrInstGen *container_type_value = instruction->container_type->child;
-    ZigType *container_type = ir_resolve_type(ira, container_type_value);
-    if (type_is_invalid(container_type))
-        return ira->codegen->invalid_inst_gen;
-
-    if ((err = type_resolve(ira->codegen, container_type, ResolveStatusSizeKnown)))
-        return ira->codegen->invalid_inst_gen;
-
-    uint64_t member_index;
-    IrInstGen *index_value = instruction->member_index->child;
-    if (!ir_resolve_usize(ira, index_value, &member_index))
-        return ira->codegen->invalid_inst_gen;
-
-    if (container_type->id == ZigTypeIdStruct) {
-        if (member_index >= container_type->data.structure.src_field_count) {
-            ir_add_error(ira, &index_value->base,
-                buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
-                    member_index, buf_ptr(&container_type->name), container_type->data.structure.src_field_count));
-            return ira->codegen->invalid_inst_gen;
-        }
-        TypeStructField *field = container_type->data.structure.fields[member_index];
-
-        IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr);
-        init_const_str_lit(ira->codegen, result->value, field->name);
-        return result;
-    } else if (container_type->id == ZigTypeIdEnum) {
-        if (member_index >= container_type->data.enumeration.src_field_count) {
-            ir_add_error(ira, &index_value->base,
-                buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
-                    member_index, buf_ptr(&container_type->name), container_type->data.enumeration.src_field_count));
-            return ira->codegen->invalid_inst_gen;
-        }
-        TypeEnumField *field = &container_type->data.enumeration.fields[member_index];
-
-        IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr);
-        init_const_str_lit(ira->codegen, result->value, field->name);
-        return result;
-    } else if (container_type->id == ZigTypeIdUnion) {
-        if (member_index >= container_type->data.unionation.src_field_count) {
-            ir_add_error(ira, &index_value->base,
-                buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
-                    member_index, buf_ptr(&container_type->name), container_type->data.unionation.src_field_count));
-            return ira->codegen->invalid_inst_gen;
-        }
-        TypeUnionField *field = &container_type->data.unionation.fields[member_index];
-
-        IrInstGen *result = ir_const(ira, &instruction->base.base, nullptr);
-        init_const_str_lit(ira->codegen, result->value, field->name);
-        return result;
-    } else {
-        ir_add_error(ira, &container_type_value->base,
-            buf_sprintf("type '%s' does not support @memberName", buf_ptr(&container_type->name)));
-        return ira->codegen->invalid_inst_gen;
-    }
-}
-
 static IrInstGen *ir_analyze_instruction_has_field(IrAnalyze *ira, IrInstSrcHasField *instruction) {
     Error err;
     ZigType *container_type = ir_resolve_type(ira, instruction->container_type->child);
@@ -29556,12 +29286,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc
             return ir_analyze_instruction_memcpy(ira, (IrInstSrcMemcpy *)instruction);
         case IrInstSrcIdSlice:
             return ir_analyze_instruction_slice(ira, (IrInstSrcSlice *)instruction);
-        case IrInstSrcIdMemberCount:
-            return ir_analyze_instruction_member_count(ira, (IrInstSrcMemberCount *)instruction);
-        case IrInstSrcIdMemberType:
-            return ir_analyze_instruction_member_type(ira, (IrInstSrcMemberType *)instruction);
-        case IrInstSrcIdMemberName:
-            return ir_analyze_instruction_member_name(ira, (IrInstSrcMemberName *)instruction);
         case IrInstSrcIdBreakpoint:
             return ir_analyze_instruction_breakpoint(ira, (IrInstSrcBreakpoint *)instruction);
         case IrInstSrcIdReturnAddress:
@@ -29616,8 +29340,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc
             return ir_analyze_instruction_type(ira, (IrInstSrcType *)instruction);
         case IrInstSrcIdHasField:
             return ir_analyze_instruction_has_field(ira, (IrInstSrcHasField *) instruction);
-        case IrInstSrcIdTypeId:
-            return ir_analyze_instruction_type_id(ira, (IrInstSrcTypeId *)instruction);
         case IrInstSrcIdSetEvalBranchQuota:
             return ir_analyze_instruction_set_eval_branch_quota(ira, (IrInstSrcSetEvalBranchQuota *)instruction);
         case IrInstSrcIdPtrType:
@@ -30038,9 +29760,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) {
         case IrInstSrcIdSplat:
         case IrInstSrcIdBoolNot:
         case IrInstSrcIdSlice:
-        case IrInstSrcIdMemberCount:
-        case IrInstSrcIdMemberType:
-        case IrInstSrcIdMemberName:
         case IrInstSrcIdAlignOf:
         case IrInstSrcIdReturnAddress:
         case IrInstSrcIdFrameAddress:
@@ -30067,7 +29786,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) {
         case IrInstSrcIdTypeInfo:
         case IrInstSrcIdType:
         case IrInstSrcIdHasField:
-        case IrInstSrcIdTypeId:
         case IrInstSrcIdAlignCast:
         case IrInstSrcIdImplicitCast:
         case IrInstSrcIdResolveResult:
src/ir_print.cpp
@@ -191,12 +191,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) {
             return "SrcMemcpy";
         case IrInstSrcIdSlice:
             return "SrcSlice";
-        case IrInstSrcIdMemberCount:
-            return "SrcMemberCount";
-        case IrInstSrcIdMemberType:
-            return "SrcMemberType";
-        case IrInstSrcIdMemberName:
-            return "SrcMemberName";
         case IrInstSrcIdBreakpoint:
             return "SrcBreakpoint";
         case IrInstSrcIdReturnAddress:
@@ -269,8 +263,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) {
             return "SrcType";
         case IrInstSrcIdHasField:
             return "SrcHasField";
-        case IrInstSrcIdTypeId:
-            return "SrcTypeId";
         case IrInstSrcIdSetEvalBranchQuota:
             return "SrcSetEvalBranchQuota";
         case IrInstSrcIdPtrType:
@@ -1784,28 +1776,6 @@ static void ir_print_slice_gen(IrPrintGen *irp, IrInstGenSlice *instruction) {
     ir_print_other_inst_gen(irp, instruction->result_loc);
 }
 
-static void ir_print_member_count(IrPrintSrc *irp, IrInstSrcMemberCount *instruction) {
-    fprintf(irp->f, "@memberCount(");
-    ir_print_other_inst_src(irp, instruction->container);
-    fprintf(irp->f, ")");
-}
-
-static void ir_print_member_type(IrPrintSrc *irp, IrInstSrcMemberType *instruction) {
-    fprintf(irp->f, "@memberType(");
-    ir_print_other_inst_src(irp, instruction->container_type);
-    fprintf(irp->f, ", ");
-    ir_print_other_inst_src(irp, instruction->member_index);
-    fprintf(irp->f, ")");
-}
-
-static void ir_print_member_name(IrPrintSrc *irp, IrInstSrcMemberName *instruction) {
-    fprintf(irp->f, "@memberName(");
-    ir_print_other_inst_src(irp, instruction->container_type);
-    fprintf(irp->f, ", ");
-    ir_print_other_inst_src(irp, instruction->member_index);
-    fprintf(irp->f, ")");
-}
-
 static void ir_print_breakpoint(IrPrintSrc *irp, IrInstSrcBreakpoint *instruction) {
     fprintf(irp->f, "@breakpoint()");
 }
@@ -2279,12 +2249,6 @@ static void ir_print_has_field(IrPrintSrc *irp, IrInstSrcHasField *instruction)
     fprintf(irp->f, ")");
 }
 
-static void ir_print_type_id(IrPrintSrc *irp, IrInstSrcTypeId *instruction) {
-    fprintf(irp->f, "@typeId(");
-    ir_print_other_inst_src(irp, instruction->type_value);
-    fprintf(irp->f, ")");
-}
-
 static void ir_print_set_eval_branch_quota(IrPrintSrc *irp, IrInstSrcSetEvalBranchQuota *instruction) {
     fprintf(irp->f, "@setEvalBranchQuota(");
     ir_print_other_inst_src(irp, instruction->new_quota);
@@ -2799,15 +2763,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai
         case IrInstSrcIdSlice:
             ir_print_slice_src(irp, (IrInstSrcSlice *)instruction);
             break;
-        case IrInstSrcIdMemberCount:
-            ir_print_member_count(irp, (IrInstSrcMemberCount *)instruction);
-            break;
-        case IrInstSrcIdMemberType:
-            ir_print_member_type(irp, (IrInstSrcMemberType *)instruction);
-            break;
-        case IrInstSrcIdMemberName:
-            ir_print_member_name(irp, (IrInstSrcMemberName *)instruction);
-            break;
         case IrInstSrcIdBreakpoint:
             ir_print_breakpoint(irp, (IrInstSrcBreakpoint *)instruction);
             break;
@@ -2907,9 +2862,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai
         case IrInstSrcIdHasField:
             ir_print_has_field(irp, (IrInstSrcHasField *)instruction);
             break;
-        case IrInstSrcIdTypeId:
-            ir_print_type_id(irp, (IrInstSrcTypeId *)instruction);
-            break;
         case IrInstSrcIdSetEvalBranchQuota:
             ir_print_set_eval_branch_quota(irp, (IrInstSrcSetEvalBranchQuota *)instruction);
             break;