| ... | @@ -78,7 +78,8 @@ pub const Type = extern union { | ... | @@ -78,7 +78,8 @@ pub const Type = extern union { |
| 78 | .const_slice, | 78 | .const_slice, |
| 79 | .mut_slice, | 79 | .mut_slice, |
| 80 | .pointer, | 80 | .pointer, |
| 81 | .inferred_alloc, | 81 | .inferred_alloc_const, |
| | 82 | .inferred_alloc_mut, |
| 82 | => return .Pointer, | 83 | => return .Pointer, |
| 83 | | 84 | |
| 84 | .optional, | 85 | .optional, |
| ... | @@ -159,7 +160,8 @@ pub const Type = extern union { | ... | @@ -159,7 +160,8 @@ pub const Type = extern union { |
| 159 | .optional_single_mut_pointer, | 160 | .optional_single_mut_pointer, |
| 160 | => self.cast(Payload.ElemType), | 161 | => self.cast(Payload.ElemType), |
| 161 | | 162 | |
| 162 | .inferred_alloc => unreachable, | 163 | .inferred_alloc_const => unreachable, |
| | 164 | .inferred_alloc_mut => unreachable, |
| 163 | | 165 | |
| 164 | else => null, | 166 | else => null, |
| 165 | }; | 167 | }; |
| ... | @@ -387,7 +389,8 @@ pub const Type = extern union { | ... | @@ -387,7 +389,8 @@ pub const Type = extern union { |
| 387 | .enum_literal, | 389 | .enum_literal, |
| 388 | .anyerror_void_error_union, | 390 | .anyerror_void_error_union, |
| 389 | .@"anyframe", | 391 | .@"anyframe", |
| 390 | .inferred_alloc, | 392 | .inferred_alloc_const, |
| | 393 | .inferred_alloc_mut, |
| 391 | => unreachable, | 394 | => unreachable, |
| 392 | | 395 | |
| 393 | .array_u8, | 396 | .array_u8, |
| ... | @@ -690,7 +693,8 @@ pub const Type = extern union { | ... | @@ -690,7 +693,8 @@ pub const Type = extern union { |
| 690 | const name = ty.castTag(.error_set_single).?.data; | 693 | const name = ty.castTag(.error_set_single).?.data; |
| 691 | return out_stream.print("error{{{s}}}", .{name}); | 694 | return out_stream.print("error{{{s}}}", .{name}); |
| 692 | }, | 695 | }, |
| 693 | .inferred_alloc => return out_stream.writeAll("(inferred allocation type)"), | 696 | .inferred_alloc_const => return out_stream.writeAll("(inferred_alloc_const)"), |
| | 697 | .inferred_alloc_mut => return out_stream.writeAll("(inferred_alloc_mut)"), |
| 694 | } | 698 | } |
| 695 | unreachable; | 699 | unreachable; |
| 696 | } | 700 | } |
| ... | @@ -738,7 +742,8 @@ pub const Type = extern union { | ... | @@ -738,7 +742,8 @@ pub const Type = extern union { |
| 738 | .single_const_pointer_to_comptime_int => return Value.initTag(.single_const_pointer_to_comptime_int_type), | 742 | .single_const_pointer_to_comptime_int => return Value.initTag(.single_const_pointer_to_comptime_int_type), |
| 739 | .const_slice_u8 => return Value.initTag(.const_slice_u8_type), | 743 | .const_slice_u8 => return Value.initTag(.const_slice_u8_type), |
| 740 | .enum_literal => return Value.initTag(.enum_literal_type), | 744 | .enum_literal => return Value.initTag(.enum_literal_type), |
| 741 | .inferred_alloc => unreachable, | 745 | .inferred_alloc_const => unreachable, |
| | 746 | .inferred_alloc_mut => unreachable, |
| 742 | else => return Value.Tag.ty.create(allocator, self), | 747 | else => return Value.Tag.ty.create(allocator, self), |
| 743 | } | 748 | } |
| 744 | } | 749 | } |
| ... | @@ -810,7 +815,8 @@ pub const Type = extern union { | ... | @@ -810,7 +815,8 @@ pub const Type = extern union { |
| 810 | .empty_struct, | 815 | .empty_struct, |
| 811 | => false, | 816 | => false, |
| 812 | | 817 | |
| 813 | .inferred_alloc => unreachable, | 818 | .inferred_alloc_const => unreachable, |
| | 819 | .inferred_alloc_mut => unreachable, |
| 814 | }; | 820 | }; |
| 815 | } | 821 | } |
| 816 | | 822 | |
| ... | @@ -928,7 +934,8 @@ pub const Type = extern union { | ... | @@ -928,7 +934,8 @@ pub const Type = extern union { |
| 928 | .@"undefined", | 934 | .@"undefined", |
| 929 | .enum_literal, | 935 | .enum_literal, |
| 930 | .empty_struct, | 936 | .empty_struct, |
| 931 | .inferred_alloc, | 937 | .inferred_alloc_const, |
| | 938 | .inferred_alloc_mut, |
| 932 | => unreachable, | 939 | => unreachable, |
| 933 | }; | 940 | }; |
| 934 | } | 941 | } |
| ... | @@ -952,7 +959,8 @@ pub const Type = extern union { | ... | @@ -952,7 +959,8 @@ pub const Type = extern union { |
| 952 | .enum_literal => unreachable, | 959 | .enum_literal => unreachable, |
| 953 | .single_const_pointer_to_comptime_int => unreachable, | 960 | .single_const_pointer_to_comptime_int => unreachable, |
| 954 | .empty_struct => unreachable, | 961 | .empty_struct => unreachable, |
| 955 | .inferred_alloc => unreachable, | 962 | .inferred_alloc_const => unreachable, |
| | 963 | .inferred_alloc_mut => unreachable, |
| 956 | | 964 | |
| 957 | .u8, | 965 | .u8, |
| 958 | .i8, | 966 | .i8, |
| ... | @@ -1131,7 +1139,8 @@ pub const Type = extern union { | ... | @@ -1131,7 +1139,8 @@ pub const Type = extern union { |
| 1131 | .single_const_pointer, | 1139 | .single_const_pointer, |
| 1132 | .single_mut_pointer, | 1140 | .single_mut_pointer, |
| 1133 | .single_const_pointer_to_comptime_int, | 1141 | .single_const_pointer_to_comptime_int, |
| 1134 | .inferred_alloc, | 1142 | .inferred_alloc_const, |
| | 1143 | .inferred_alloc_mut, |
| 1135 | => true, | 1144 | => true, |
| 1136 | | 1145 | |
| 1137 | .pointer => self.castTag(.pointer).?.data.size == .One, | 1146 | .pointer => self.castTag(.pointer).?.data.size == .One, |
| ... | @@ -1214,7 +1223,8 @@ pub const Type = extern union { | ... | @@ -1214,7 +1223,8 @@ pub const Type = extern union { |
| 1214 | .single_const_pointer, | 1223 | .single_const_pointer, |
| 1215 | .single_mut_pointer, | 1224 | .single_mut_pointer, |
| 1216 | .single_const_pointer_to_comptime_int, | 1225 | .single_const_pointer_to_comptime_int, |
| 1217 | .inferred_alloc, | 1226 | .inferred_alloc_const, |
| | 1227 | .inferred_alloc_mut, |
| 1218 | => .One, | 1228 | => .One, |
| 1219 | | 1229 | |
| 1220 | .pointer => self.castTag(.pointer).?.data.size, | 1230 | .pointer => self.castTag(.pointer).?.data.size, |
| ... | @@ -1285,7 +1295,8 @@ pub const Type = extern union { | ... | @@ -1285,7 +1295,8 @@ pub const Type = extern union { |
| 1285 | .error_set, | 1295 | .error_set, |
| 1286 | .error_set_single, | 1296 | .error_set_single, |
| 1287 | .empty_struct, | 1297 | .empty_struct, |
| 1288 | .inferred_alloc, | 1298 | .inferred_alloc_const, |
| | 1299 | .inferred_alloc_mut, |
| 1289 | => false, | 1300 | => false, |
| 1290 | | 1301 | |
| 1291 | .const_slice, | 1302 | .const_slice, |
| ... | @@ -1358,7 +1369,8 @@ pub const Type = extern union { | ... | @@ -1358,7 +1369,8 @@ pub const Type = extern union { |
| 1358 | .error_set, | 1369 | .error_set, |
| 1359 | .error_set_single, | 1370 | .error_set_single, |
| 1360 | .empty_struct, | 1371 | .empty_struct, |
| 1361 | .inferred_alloc, | 1372 | .inferred_alloc_const, |
| | 1373 | .inferred_alloc_mut, |
| 1362 | => false, | 1374 | => false, |
| 1363 | | 1375 | |
| 1364 | .single_const_pointer, | 1376 | .single_const_pointer, |
| ... | @@ -1440,7 +1452,8 @@ pub const Type = extern union { | ... | @@ -1440,7 +1452,8 @@ pub const Type = extern union { |
| 1440 | .error_set, | 1452 | .error_set, |
| 1441 | .error_set_single, | 1453 | .error_set_single, |
| 1442 | .empty_struct, | 1454 | .empty_struct, |
| 1443 | .inferred_alloc, | 1455 | .inferred_alloc_const, |
| | 1456 | .inferred_alloc_mut, |
| 1444 | => false, | 1457 | => false, |
| 1445 | | 1458 | |
| 1446 | .pointer => { | 1459 | .pointer => { |
| ... | @@ -1517,7 +1530,8 @@ pub const Type = extern union { | ... | @@ -1517,7 +1530,8 @@ pub const Type = extern union { |
| 1517 | .error_set, | 1530 | .error_set, |
| 1518 | .error_set_single, | 1531 | .error_set_single, |
| 1519 | .empty_struct, | 1532 | .empty_struct, |
| 1520 | .inferred_alloc, | 1533 | .inferred_alloc_const, |
| | 1534 | .inferred_alloc_mut, |
| 1521 | => false, | 1535 | => false, |
| 1522 | | 1536 | |
| 1523 | .pointer => { | 1537 | .pointer => { |
| ... | @@ -1636,7 +1650,8 @@ pub const Type = extern union { | ... | @@ -1636,7 +1650,8 @@ pub const Type = extern union { |
| 1636 | .error_set => unreachable, | 1650 | .error_set => unreachable, |
| 1637 | .error_set_single => unreachable, | 1651 | .error_set_single => unreachable, |
| 1638 | .empty_struct => unreachable, | 1652 | .empty_struct => unreachable, |
| 1639 | .inferred_alloc => unreachable, | 1653 | .inferred_alloc_const => unreachable, |
| | 1654 | .inferred_alloc_mut => unreachable, |
| 1640 | | 1655 | |
| 1641 | .array => self.castTag(.array).?.data.elem_type, | 1656 | .array => self.castTag(.array).?.data.elem_type, |
| 1642 | .array_sentinel => self.castTag(.array_sentinel).?.data.elem_type, | 1657 | .array_sentinel => self.castTag(.array_sentinel).?.data.elem_type, |
| ... | @@ -1758,7 +1773,8 @@ pub const Type = extern union { | ... | @@ -1758,7 +1773,8 @@ pub const Type = extern union { |
| 1758 | .error_set, | 1773 | .error_set, |
| 1759 | .error_set_single, | 1774 | .error_set_single, |
| 1760 | .empty_struct, | 1775 | .empty_struct, |
| 1761 | .inferred_alloc, | 1776 | .inferred_alloc_const, |
| | 1777 | .inferred_alloc_mut, |
| 1762 | => unreachable, | 1778 | => unreachable, |
| 1763 | | 1779 | |
| 1764 | .array => self.castTag(.array).?.data.len, | 1780 | .array => self.castTag(.array).?.data.len, |
| ... | @@ -1825,7 +1841,8 @@ pub const Type = extern union { | ... | @@ -1825,7 +1841,8 @@ pub const Type = extern union { |
| 1825 | .error_set, | 1841 | .error_set, |
| 1826 | .error_set_single, | 1842 | .error_set_single, |
| 1827 | .empty_struct, | 1843 | .empty_struct, |
| 1828 | .inferred_alloc, | 1844 | .inferred_alloc_const, |
| | 1845 | .inferred_alloc_mut, |
| 1829 | => unreachable, | 1846 | => unreachable, |
| 1830 | | 1847 | |
| 1831 | .single_const_pointer, | 1848 | .single_const_pointer, |
| ... | @@ -1909,7 +1926,8 @@ pub const Type = extern union { | ... | @@ -1909,7 +1926,8 @@ pub const Type = extern union { |
| 1909 | .error_set, | 1926 | .error_set, |
| 1910 | .error_set_single, | 1927 | .error_set_single, |
| 1911 | .empty_struct, | 1928 | .empty_struct, |
| 1912 | .inferred_alloc, | 1929 | .inferred_alloc_const, |
| | 1930 | .inferred_alloc_mut, |
| 1913 | => false, | 1931 | => false, |
| 1914 | | 1932 | |
| 1915 | .int_signed, | 1933 | .int_signed, |
| ... | @@ -1985,7 +2003,8 @@ pub const Type = extern union { | ... | @@ -1985,7 +2003,8 @@ pub const Type = extern union { |
| 1985 | .error_set, | 2003 | .error_set, |
| 1986 | .error_set_single, | 2004 | .error_set_single, |
| 1987 | .empty_struct, | 2005 | .empty_struct, |
| 1988 | .inferred_alloc, | 2006 | .inferred_alloc_const, |
| | 2007 | .inferred_alloc_mut, |
| 1989 | => false, | 2008 | => false, |
| 1990 | | 2009 | |
| 1991 | .int_unsigned, | 2010 | .int_unsigned, |
| ... | @@ -2051,7 +2070,8 @@ pub const Type = extern union { | ... | @@ -2051,7 +2070,8 @@ pub const Type = extern union { |
| 2051 | .error_set, | 2070 | .error_set, |
| 2052 | .error_set_single, | 2071 | .error_set_single, |
| 2053 | .empty_struct, | 2072 | .empty_struct, |
| 2054 | .inferred_alloc, | 2073 | .inferred_alloc_const, |
| | 2074 | .inferred_alloc_mut, |
| 2055 | => unreachable, | 2075 | => unreachable, |
| 2056 | | 2076 | |
| 2057 | .int_unsigned => .{ | 2077 | .int_unsigned => .{ |
| ... | @@ -2141,7 +2161,8 @@ pub const Type = extern union { | ... | @@ -2141,7 +2161,8 @@ pub const Type = extern union { |
| 2141 | .error_set, | 2161 | .error_set, |
| 2142 | .error_set_single, | 2162 | .error_set_single, |
| 2143 | .empty_struct, | 2163 | .empty_struct, |
| 2144 | .inferred_alloc, | 2164 | .inferred_alloc_const, |
| | 2165 | .inferred_alloc_mut, |
| 2145 | => false, | 2166 | => false, |
| 2146 | | 2167 | |
| 2147 | .usize, | 2168 | .usize, |
| ... | @@ -2254,7 +2275,8 @@ pub const Type = extern union { | ... | @@ -2254,7 +2275,8 @@ pub const Type = extern union { |
| 2254 | .error_set, | 2275 | .error_set, |
| 2255 | .error_set_single, | 2276 | .error_set_single, |
| 2256 | .empty_struct, | 2277 | .empty_struct, |
| 2257 | .inferred_alloc, | 2278 | .inferred_alloc_const, |
| | 2279 | .inferred_alloc_mut, |
| 2258 | => unreachable, | 2280 | => unreachable, |
| 2259 | }; | 2281 | }; |
| 2260 | } | 2282 | } |
| ... | @@ -2333,7 +2355,8 @@ pub const Type = extern union { | ... | @@ -2333,7 +2355,8 @@ pub const Type = extern union { |
| 2333 | .error_set, | 2355 | .error_set, |
| 2334 | .error_set_single, | 2356 | .error_set_single, |
| 2335 | .empty_struct, | 2357 | .empty_struct, |
| 2336 | .inferred_alloc, | 2358 | .inferred_alloc_const, |
| | 2359 | .inferred_alloc_mut, |
| 2337 | => unreachable, | 2360 | => unreachable, |
| 2338 | } | 2361 | } |
| 2339 | } | 2362 | } |
| ... | @@ -2411,7 +2434,8 @@ pub const Type = extern union { | ... | @@ -2411,7 +2434,8 @@ pub const Type = extern union { |
| 2411 | .error_set, | 2434 | .error_set, |
| 2412 | .error_set_single, | 2435 | .error_set_single, |
| 2413 | .empty_struct, | 2436 | .empty_struct, |
| 2414 | .inferred_alloc, | 2437 | .inferred_alloc_const, |
| | 2438 | .inferred_alloc_mut, |
| 2415 | => unreachable, | 2439 | => unreachable, |
| 2416 | } | 2440 | } |
| 2417 | } | 2441 | } |
| ... | @@ -2489,7 +2513,8 @@ pub const Type = extern union { | ... | @@ -2489,7 +2513,8 @@ pub const Type = extern union { |
| 2489 | .error_set, | 2513 | .error_set, |
| 2490 | .error_set_single, | 2514 | .error_set_single, |
| 2491 | .empty_struct, | 2515 | .empty_struct, |
| 2492 | .inferred_alloc, | 2516 | .inferred_alloc_const, |
| | 2517 | .inferred_alloc_mut, |
| 2493 | => unreachable, | 2518 | => unreachable, |
| 2494 | }; | 2519 | }; |
| 2495 | } | 2520 | } |
| ... | @@ -2564,7 +2589,8 @@ pub const Type = extern union { | ... | @@ -2564,7 +2589,8 @@ pub const Type = extern union { |
| 2564 | .error_set, | 2589 | .error_set, |
| 2565 | .error_set_single, | 2590 | .error_set_single, |
| 2566 | .empty_struct, | 2591 | .empty_struct, |
| 2567 | .inferred_alloc, | 2592 | .inferred_alloc_const, |
| | 2593 | .inferred_alloc_mut, |
| 2568 | => unreachable, | 2594 | => unreachable, |
| 2569 | }; | 2595 | }; |
| 2570 | } | 2596 | } |
| ... | @@ -2639,7 +2665,8 @@ pub const Type = extern union { | ... | @@ -2639,7 +2665,8 @@ pub const Type = extern union { |
| 2639 | .error_set, | 2665 | .error_set, |
| 2640 | .error_set_single, | 2666 | .error_set_single, |
| 2641 | .empty_struct, | 2667 | .empty_struct, |
| 2642 | .inferred_alloc, | 2668 | .inferred_alloc_const, |
| | 2669 | .inferred_alloc_mut, |
| 2643 | => unreachable, | 2670 | => unreachable, |
| 2644 | }; | 2671 | }; |
| 2645 | } | 2672 | } |
| ... | @@ -2714,7 +2741,8 @@ pub const Type = extern union { | ... | @@ -2714,7 +2741,8 @@ pub const Type = extern union { |
| 2714 | .error_set, | 2741 | .error_set, |
| 2715 | .error_set_single, | 2742 | .error_set_single, |
| 2716 | .empty_struct, | 2743 | .empty_struct, |
| 2717 | .inferred_alloc, | 2744 | .inferred_alloc_const, |
| | 2745 | .inferred_alloc_mut, |
| 2718 | => false, | 2746 | => false, |
| 2719 | }; | 2747 | }; |
| 2720 | } | 2748 | } |
| ... | @@ -2807,7 +2835,8 @@ pub const Type = extern union { | ... | @@ -2807,7 +2835,8 @@ pub const Type = extern union { |
| 2807 | ty = ty.castTag(.pointer).?.data.pointee_type; | 2835 | ty = ty.castTag(.pointer).?.data.pointee_type; |
| 2808 | continue; | 2836 | continue; |
| 2809 | }, | 2837 | }, |
| 2810 | .inferred_alloc => unreachable, | 2838 | .inferred_alloc_const => unreachable, |
| | 2839 | .inferred_alloc_mut => unreachable, |
| 2811 | }; | 2840 | }; |
| 2812 | } | 2841 | } |
| 2813 | | 2842 | |
| ... | @@ -2876,7 +2905,8 @@ pub const Type = extern union { | ... | @@ -2876,7 +2905,8 @@ pub const Type = extern union { |
| 2876 | .error_set, | 2905 | .error_set, |
| 2877 | .error_set_single, | 2906 | .error_set_single, |
| 2878 | .empty_struct, | 2907 | .empty_struct, |
| 2879 | .inferred_alloc, | 2908 | .inferred_alloc_const, |
| | 2909 | .inferred_alloc_mut, |
| 2880 | => return false, | 2910 | => return false, |
| 2881 | | 2911 | |
| 2882 | .c_const_pointer, | 2912 | .c_const_pointer, |
| ... | @@ -2962,7 +2992,8 @@ pub const Type = extern union { | ... | @@ -2962,7 +2992,8 @@ pub const Type = extern union { |
| 2962 | .c_const_pointer, | 2992 | .c_const_pointer, |
| 2963 | .c_mut_pointer, | 2993 | .c_mut_pointer, |
| 2964 | .pointer, | 2994 | .pointer, |
| 2965 | .inferred_alloc, | 2995 | .inferred_alloc_const, |
| | 2996 | .inferred_alloc_mut, |
| 2966 | => unreachable, | 2997 | => unreachable, |
| 2967 | | 2998 | |
| 2968 | .empty_struct => self.castTag(.empty_struct).?.data, | 2999 | .empty_struct => self.castTag(.empty_struct).?.data, |
| ... | @@ -3077,7 +3108,9 @@ pub const Type = extern union { | ... | @@ -3077,7 +3108,9 @@ pub const Type = extern union { |
| 3077 | /// This is a special value that tracks a set of types that have been stored | 3108 | /// This is a special value that tracks a set of types that have been stored |
| 3078 | /// to an inferred allocation. It does not support most of the normal type queries. | 3109 | /// to an inferred allocation. It does not support most of the normal type queries. |
| 3079 | /// However it does respond to `isConstPtr`, `ptrSize`, `zigTypeTag`, etc. | 3110 | /// However it does respond to `isConstPtr`, `ptrSize`, `zigTypeTag`, etc. |
| 3080 | inferred_alloc, // See last_no_payload_tag below. | 3111 | inferred_alloc_mut, |
| | 3112 | /// Same as `inferred_alloc_mut` but the local is `var` not `const`. |
| | 3113 | inferred_alloc_const, // See last_no_payload_tag below. |
| 3081 | // After this, the tag requires a payload. | 3114 | // After this, the tag requires a payload. |
| 3082 | | 3115 | |
| 3083 | array_u8, | 3116 | array_u8, |
| ... | @@ -3105,7 +3138,7 @@ pub const Type = extern union { | ... | @@ -3105,7 +3138,7 @@ pub const Type = extern union { |
| 3105 | error_set_single, | 3138 | error_set_single, |
| 3106 | empty_struct, | 3139 | empty_struct, |
| 3107 | | 3140 | |
| 3108 | pub const last_no_payload_tag = Tag.inferred_alloc; | 3141 | pub const last_no_payload_tag = Tag.inferred_alloc_const; |
| 3109 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; | 3142 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; |
| 3110 | | 3143 | |
| 3111 | pub fn Type(comptime t: Tag) type { | 3144 | pub fn Type(comptime t: Tag) type { |
| ... | @@ -3152,7 +3185,8 @@ pub const Type = extern union { | ... | @@ -3152,7 +3185,8 @@ pub const Type = extern union { |
| 3152 | .anyerror_void_error_union, | 3185 | .anyerror_void_error_union, |
| 3153 | .@"anyframe", | 3186 | .@"anyframe", |
| 3154 | .const_slice_u8, | 3187 | .const_slice_u8, |
| 3155 | .inferred_alloc, | 3188 | .inferred_alloc_const, |
| | 3189 | .inferred_alloc_mut, |
| 3156 | => @compileError("Type Tag " ++ @tagName(t) ++ " has no payload"), | 3190 | => @compileError("Type Tag " ++ @tagName(t) ++ " has no payload"), |
| 3157 | | 3191 | |
| 3158 | .array_u8, | 3192 | .array_u8, |