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