| author | |
| committer | |
| log | 8dc58a4e944e5d319079a56802ce0824096bd7b5 |
| tree | cade0f159726a71d21459536a5f536cc93647146 |
| parent | 4e97cf50d270a991243f97bab77a61c89219f843 |
| parent | 96e46cdd6e754f633d660a3a1ae5dd869d848fdc |
| signature |
Remove @OpaqueType7 files changed, 5 insertions(+), 47 deletions(-)
lib/std/zig/render.zig+4| ... | @@ -1478,6 +1478,10 @@ fn renderExpression( | ... | @@ -1478,6 +1478,10 @@ fn renderExpression( |
| 1478 | .BuiltinCall => { | 1478 | .BuiltinCall => { |
| 1479 | const builtin_call = @fieldParentPtr(ast.Node.BuiltinCall, "base", base); | 1479 | const builtin_call = @fieldParentPtr(ast.Node.BuiltinCall, "base", base); |
| 1480 | 1480 | ||
| 1481 | // TODO remove after 0.7.0 release | ||
| 1482 | if (mem.eql(u8, tree.tokenSlice(builtin_call.builtin_token), "@OpaqueType")) | ||
| 1483 | return stream.writeAll("@Type(.Opaque)"); | ||
| 1484 | |||
| 1481 | try renderToken(tree, stream, builtin_call.builtin_token, indent, start_col, Space.None); // @name | 1485 | try renderToken(tree, stream, builtin_call.builtin_token, indent, start_col, Space.None); // @name |
| 1482 | 1486 | ||
| 1483 | const src_params_trailing_comma = blk: { | 1487 | const src_params_trailing_comma = blk: { |
src/all_types.hpp-6| ... | @@ -1809,7 +1809,6 @@ enum BuiltinFnId { | ... | @@ -1809,7 +1809,6 @@ enum BuiltinFnId { |
| 1809 | BuiltinFnIdShrExact, | 1809 | BuiltinFnIdShrExact, |
| 1810 | BuiltinFnIdSetEvalBranchQuota, | 1810 | BuiltinFnIdSetEvalBranchQuota, |
| 1811 | BuiltinFnIdAlignCast, | 1811 | BuiltinFnIdAlignCast, |
| 1812 | BuiltinFnIdOpaqueType, | ||
| 1813 | BuiltinFnIdThis, | 1812 | BuiltinFnIdThis, |
| 1814 | BuiltinFnIdSetAlignStack, | 1813 | BuiltinFnIdSetAlignStack, |
| 1815 | BuiltinFnIdExport, | 1814 | BuiltinFnIdExport, |
| ... | @@ -2734,7 +2733,6 @@ enum IrInstSrcId { | ... | @@ -2734,7 +2733,6 @@ enum IrInstSrcId { |
| 2734 | IrInstSrcIdImplicitCast, | 2733 | IrInstSrcIdImplicitCast, |
| 2735 | IrInstSrcIdResolveResult, | 2734 | IrInstSrcIdResolveResult, |
| 2736 | IrInstSrcIdResetResult, | 2735 | IrInstSrcIdResetResult, |
| 2737 | IrInstSrcIdOpaqueType, | ||
| 2738 | IrInstSrcIdSetAlignStack, | 2736 | IrInstSrcIdSetAlignStack, |
| 2739 | IrInstSrcIdArgType, | 2737 | IrInstSrcIdArgType, |
| 2740 | IrInstSrcIdExport, | 2738 | IrInstSrcIdExport, |
| ... | @@ -4234,10 +4232,6 @@ struct IrInstGenAlignCast { | ... | @@ -4234,10 +4232,6 @@ struct IrInstGenAlignCast { |
| 4234 | IrInstGen *target; | 4232 | IrInstGen *target; |
| 4235 | }; | 4233 | }; |
| 4236 | 4234 | ||
| 4237 | struct IrInstSrcOpaqueType { | ||
| 4238 | IrInstSrc base; | ||
| 4239 | }; | ||
| 4240 | |||
| 4241 | struct IrInstSrcSetAlignStack { | 4235 | struct IrInstSrcSetAlignStack { |
| 4242 | IrInstSrc base; | 4236 | IrInstSrc base; |
| 4243 | 4237 |
src/codegen.cpp-1| ... | @@ -8699,7 +8699,6 @@ static void define_builtin_fns(CodeGen *g) { | ... | @@ -8699,7 +8699,6 @@ static void define_builtin_fns(CodeGen *g) { |
| 8699 | create_builtin_fn(g, BuiltinFnIdShrExact, "shrExact", 2); | 8699 | create_builtin_fn(g, BuiltinFnIdShrExact, "shrExact", 2); |
| 8700 | create_builtin_fn(g, BuiltinFnIdSetEvalBranchQuota, "setEvalBranchQuota", 1); | 8700 | create_builtin_fn(g, BuiltinFnIdSetEvalBranchQuota, "setEvalBranchQuota", 1); |
| 8701 | create_builtin_fn(g, BuiltinFnIdAlignCast, "alignCast", 2); | 8701 | create_builtin_fn(g, BuiltinFnIdAlignCast, "alignCast", 2); |
| 8702 | create_builtin_fn(g, BuiltinFnIdOpaqueType, "OpaqueType", 0); | ||
| 8703 | create_builtin_fn(g, BuiltinFnIdSetAlignStack, "setAlignStack", 1); | 8702 | create_builtin_fn(g, BuiltinFnIdSetAlignStack, "setAlignStack", 1); |
| 8704 | create_builtin_fn(g, BuiltinFnIdExport, "export", 2); | 8703 | create_builtin_fn(g, BuiltinFnIdExport, "export", 2); |
| 8705 | create_builtin_fn(g, BuiltinFnIdErrorReturnTrace, "errorReturnTrace", 0); | 8704 | create_builtin_fn(g, BuiltinFnIdErrorReturnTrace, "errorReturnTrace", 0); |
src/ir.cpp-29| ... | @@ -505,8 +505,6 @@ static void destroy_instruction_src(IrInstSrc *inst) { | ... | @@ -505,8 +505,6 @@ static void destroy_instruction_src(IrInstSrc *inst) { |
| 505 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResolveResult *>(inst)); | 505 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResolveResult *>(inst)); |
| 506 | case IrInstSrcIdResetResult: | 506 | case IrInstSrcIdResetResult: |
| 507 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResetResult *>(inst)); | 507 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcResetResult *>(inst)); |
| 508 | case IrInstSrcIdOpaqueType: | ||
| 509 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcOpaqueType *>(inst)); | ||
| 510 | case IrInstSrcIdSetAlignStack: | 508 | case IrInstSrcIdSetAlignStack: |
| 511 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetAlignStack *>(inst)); | 509 | return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcSetAlignStack *>(inst)); |
| 512 | case IrInstSrcIdArgType: | 510 | case IrInstSrcIdArgType: |
| ... | @@ -1532,10 +1530,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcResetResult *) { | ... | @@ -1532,10 +1530,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcResetResult *) { |
| 1532 | return IrInstSrcIdResetResult; | 1530 | return IrInstSrcIdResetResult; |
| 1533 | } | 1531 | } |
| 1534 | 1532 | ||
| 1535 | static constexpr IrInstSrcId ir_inst_id(IrInstSrcOpaqueType *) { | ||
| 1536 | return IrInstSrcIdOpaqueType; | ||
| 1537 | } | ||
| 1538 | |||
| 1539 | static constexpr IrInstSrcId ir_inst_id(IrInstSrcSetAlignStack *) { | 1533 | static constexpr IrInstSrcId ir_inst_id(IrInstSrcSetAlignStack *) { |
| 1540 | return IrInstSrcIdSetAlignStack; | 1534 | return IrInstSrcIdSetAlignStack; |
| 1541 | } | 1535 | } |
| ... | @@ -4535,12 +4529,6 @@ static IrInstSrc *ir_build_reset_result(IrBuilderSrc *irb, Scope *scope, AstNode | ... | @@ -4535,12 +4529,6 @@ static IrInstSrc *ir_build_reset_result(IrBuilderSrc *irb, Scope *scope, AstNode |
| 4535 | return &instruction->base; | 4529 | return &instruction->base; |
| 4536 | } | 4530 | } |
| 4537 | 4531 | ||
| 4538 | static IrInstSrc *ir_build_opaque_type(IrBuilderSrc *irb, Scope *scope, AstNode *source_node) { | ||
| 4539 | IrInstSrcOpaqueType *instruction = ir_build_instruction<IrInstSrcOpaqueType>(irb, scope, source_node); | ||
| 4540 | |||
| 4541 | return &instruction->base; | ||
| 4542 | } | ||
| 4543 | |||
| 4544 | static IrInstSrc *ir_build_set_align_stack(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, | 4532 | static IrInstSrc *ir_build_set_align_stack(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, |
| 4545 | IrInstSrc *align_bytes) | 4533 | IrInstSrc *align_bytes) |
| 4546 | { | 4534 | { |
| ... | @@ -7310,11 +7298,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod | ... | @@ -7310,11 +7298,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod |
| 7310 | IrInstSrc *align_cast = ir_build_align_cast_src(irb, scope, node, arg0_value, arg1_value); | 7298 | IrInstSrc *align_cast = ir_build_align_cast_src(irb, scope, node, arg0_value, arg1_value); |
| 7311 | return ir_lval_wrap(irb, scope, align_cast, lval, result_loc); | 7299 | return ir_lval_wrap(irb, scope, align_cast, lval, result_loc); |
| 7312 | } | 7300 | } |
| 7313 | case BuiltinFnIdOpaqueType: | ||
| 7314 | { | ||
| 7315 | IrInstSrc *opaque_type = ir_build_opaque_type(irb, scope, node); | ||
| 7316 | return ir_lval_wrap(irb, scope, opaque_type, lval, result_loc); | ||
| 7317 | } | ||
| 7318 | case BuiltinFnIdThis: | 7301 | case BuiltinFnIdThis: |
| 7319 | { | 7302 | { |
| 7320 | IrInstSrc *this_inst = ir_gen_this(irb, scope, node); | 7303 | IrInstSrc *this_inst = ir_gen_this(irb, scope, node); |
| ... | @@ -30263,15 +30246,6 @@ static IrInstGen *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstSrcAli | ... | @@ -30263,15 +30246,6 @@ static IrInstGen *ir_analyze_instruction_align_cast(IrAnalyze *ira, IrInstSrcAli |
| 30263 | return result; | 30246 | return result; |
| 30264 | } | 30247 | } |
| 30265 | 30248 | ||
| 30266 | static IrInstGen *ir_analyze_instruction_opaque_type(IrAnalyze *ira, IrInstSrcOpaqueType *instruction) { | ||
| 30267 | Buf *bare_name = buf_alloc(); | ||
| 30268 | Buf *full_name = get_anon_type_name(ira->codegen, ira->old_irb.exec, "opaque", | ||
| 30269 | instruction->base.base.scope, instruction->base.base.source_node, bare_name); | ||
| 30270 | ZigType *result_type = get_opaque_type(ira->codegen, instruction->base.base.scope, | ||
| 30271 | instruction->base.base.source_node, buf_ptr(full_name), bare_name); | ||
| 30272 | return ir_const_type(ira, &instruction->base.base, result_type); | ||
| 30273 | } | ||
| 30274 | |||
| 30275 | static IrInstGen *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstSrcSetAlignStack *instruction) { | 30249 | static IrInstGen *ir_analyze_instruction_set_align_stack(IrAnalyze *ira, IrInstSrcSetAlignStack *instruction) { |
| 30276 | uint32_t align_bytes; | 30250 | uint32_t align_bytes; |
| 30277 | IrInstGen *align_bytes_inst = instruction->align_bytes->child; | 30251 | IrInstGen *align_bytes_inst = instruction->align_bytes->child; |
| ... | @@ -31736,8 +31710,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc | ... | @@ -31736,8 +31710,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc |
| 31736 | return ir_analyze_instruction_resolve_result(ira, (IrInstSrcResolveResult *)instruction); | 31710 | return ir_analyze_instruction_resolve_result(ira, (IrInstSrcResolveResult *)instruction); |
| 31737 | case IrInstSrcIdResetResult: | 31711 | case IrInstSrcIdResetResult: |
| 31738 | return ir_analyze_instruction_reset_result(ira, (IrInstSrcResetResult *)instruction); | 31712 | return ir_analyze_instruction_reset_result(ira, (IrInstSrcResetResult *)instruction); |
| 31739 | case IrInstSrcIdOpaqueType: | ||
| 31740 | return ir_analyze_instruction_opaque_type(ira, (IrInstSrcOpaqueType *)instruction); | ||
| 31741 | case IrInstSrcIdSetAlignStack: | 31713 | case IrInstSrcIdSetAlignStack: |
| 31742 | return ir_analyze_instruction_set_align_stack(ira, (IrInstSrcSetAlignStack *)instruction); | 31714 | return ir_analyze_instruction_set_align_stack(ira, (IrInstSrcSetAlignStack *)instruction); |
| 31743 | case IrInstSrcIdArgType: | 31715 | case IrInstSrcIdArgType: |
| ... | @@ -32181,7 +32153,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) { | ... | @@ -32181,7 +32153,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) { |
| 32181 | case IrInstSrcIdAlignCast: | 32153 | case IrInstSrcIdAlignCast: |
| 32182 | case IrInstSrcIdImplicitCast: | 32154 | case IrInstSrcIdImplicitCast: |
| 32183 | case IrInstSrcIdResolveResult: | 32155 | case IrInstSrcIdResolveResult: |
| 32184 | case IrInstSrcIdOpaqueType: | ||
| 32185 | case IrInstSrcIdArgType: | 32156 | case IrInstSrcIdArgType: |
| 32186 | case IrInstSrcIdTagType: | 32157 | case IrInstSrcIdTagType: |
| 32187 | case IrInstSrcIdErrorReturnTrace: | 32158 | case IrInstSrcIdErrorReturnTrace: |
src/ir_print.cpp-9| ... | @@ -306,8 +306,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) { | ... | @@ -306,8 +306,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) { |
| 306 | return "SrcResolveResult"; | 306 | return "SrcResolveResult"; |
| 307 | case IrInstSrcIdResetResult: | 307 | case IrInstSrcIdResetResult: |
| 308 | return "SrcResetResult"; | 308 | return "SrcResetResult"; |
| 309 | case IrInstSrcIdOpaqueType: | ||
| 310 | return "SrcOpaqueType"; | ||
| 311 | case IrInstSrcIdSetAlignStack: | 309 | case IrInstSrcIdSetAlignStack: |
| 312 | return "SrcSetAlignStack"; | 310 | return "SrcSetAlignStack"; |
| 313 | case IrInstSrcIdArgType: | 311 | case IrInstSrcIdArgType: |
| ... | @@ -2315,10 +2313,6 @@ static void ir_print_reset_result(IrPrintSrc *irp, IrInstSrcResetResult *instruc | ... | @@ -2315,10 +2313,6 @@ static void ir_print_reset_result(IrPrintSrc *irp, IrInstSrcResetResult *instruc |
| 2315 | fprintf(irp->f, ")"); | 2313 | fprintf(irp->f, ")"); |
| 2316 | } | 2314 | } |
| 2317 | 2315 | ||
| 2318 | static void ir_print_opaque_type(IrPrintSrc *irp, IrInstSrcOpaqueType *instruction) { | ||
| 2319 | fprintf(irp->f, "@OpaqueType()"); | ||
| 2320 | } | ||
| 2321 | |||
| 2322 | static void ir_print_set_align_stack(IrPrintSrc *irp, IrInstSrcSetAlignStack *instruction) { | 2316 | static void ir_print_set_align_stack(IrPrintSrc *irp, IrInstSrcSetAlignStack *instruction) { |
| 2323 | fprintf(irp->f, "@setAlignStack("); | 2317 | fprintf(irp->f, "@setAlignStack("); |
| 2324 | ir_print_other_inst_src(irp, instruction->align_bytes); | 2318 | ir_print_other_inst_src(irp, instruction->align_bytes); |
| ... | @@ -2911,9 +2905,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai | ... | @@ -2911,9 +2905,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai |
| 2911 | case IrInstSrcIdResetResult: | 2905 | case IrInstSrcIdResetResult: |
| 2912 | ir_print_reset_result(irp, (IrInstSrcResetResult *)instruction); | 2906 | ir_print_reset_result(irp, (IrInstSrcResetResult *)instruction); |
| 2913 | break; | 2907 | break; |
| 2914 | case IrInstSrcIdOpaqueType: | ||
| 2915 | ir_print_opaque_type(irp, (IrInstSrcOpaqueType *)instruction); | ||
| 2916 | break; | ||
| 2917 | case IrInstSrcIdSetAlignStack: | 2908 | case IrInstSrcIdSetAlignStack: |
| 2918 | ir_print_set_align_stack(irp, (IrInstSrcSetAlignStack *)instruction); | 2909 | ir_print_set_align_stack(irp, (IrInstSrcSetAlignStack *)instruction); |
| 2919 | break; | 2910 | break; |
test/compile_errors.zig+1-1| ... | @@ -7394,7 +7394,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -7394,7 +7394,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 7394 | }); | 7394 | }); |
| 7395 | 7395 | ||
| 7396 | cases.add("function parameter is opaque", | 7396 | cases.add("function parameter is opaque", |
| 7397 | \\const FooType = @OpaqueType(); | 7397 | \\const FooType = @Type(.Opaque); |
| 7398 | \\export fn entry1() void { | 7398 | \\export fn entry1() void { |
| 7399 | \\ const someFuncPtr: fn (FooType) void = undefined; | 7399 | \\ const someFuncPtr: fn (FooType) void = undefined; |
| 7400 | \\} | 7400 | \\} |
test/stage1/behavior/type.zig-1| ... | @@ -190,7 +190,6 @@ test "Type.ErrorUnion" { | ... | @@ -190,7 +190,6 @@ test "Type.ErrorUnion" { |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | test "Type.Opaque" { | 192 | test "Type.Opaque" { |
| 193 | testing.expect(@OpaqueType() != @Type(.Opaque)); | ||
| 194 | testing.expect(@Type(.Opaque) != @Type(.Opaque)); | 193 | testing.expect(@Type(.Opaque) != @Type(.Opaque)); |
| 195 | testing.expect(@typeInfo(@Type(.Opaque)) == .Opaque); | 194 | testing.expect(@typeInfo(@Type(.Opaque)) == .Opaque); |
| 196 | } | 195 | } |