| author | |
| committer | |
| log | d805adddd6744e0d55263c02d2a03e27ad0c7d68 |
| tree | 430dca3714090db578e6b34ed497ff2b3baee783 |
| parent | 404f5d617982e2323c6ab6b878c29880af3d64c2 |
Co-authored-by: Veikka Tuominen <git@vexu.eu>27 files changed, 219 insertions(+), 225 deletions(-)
lib/std/bit_set.zig+1-1| ... | @@ -252,7 +252,7 @@ pub fn IntegerBitSet(comptime size: u16) type { | ... | @@ -252,7 +252,7 @@ pub fn IntegerBitSet(comptime size: u16) type { |
| 252 | /// This set is good for sets with a larger size, but may use | 252 | /// This set is good for sets with a larger size, but may use |
| 253 | /// more bytes than necessary if your set is small. | 253 | /// more bytes than necessary if your set is small. |
| 254 | pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { | 254 | pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { |
| 255 | const mask_info: std.builtin.TypeInfo = @typeInfo(MaskIntType); | 255 | const mask_info: std.builtin.Type = @typeInfo(MaskIntType); |
| 256 | 256 | ||
| 257 | // Make sure the mask int is indeed an int | 257 | // Make sure the mask int is indeed an int |
| 258 | if (mask_info != .Int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType)); | 258 | if (mask_info != .Int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType)); |
lib/std/builtin.zig+5-3| ... | @@ -174,12 +174,14 @@ pub const SourceLocation = struct { | ... | @@ -174,12 +174,14 @@ pub const SourceLocation = struct { |
| 174 | column: u32, | 174 | column: u32, |
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | pub const TypeId = std.meta.Tag(TypeInfo); | 177 | pub const TypeId = std.meta.Tag(Type); |
| 178 | |||
| 179 | /// TODO deprecated, use `Type` | ||
| 180 | pub const TypeInfo = Type; | ||
| 178 | 181 | ||
| 179 | /// This data structure is used by the Zig language code generation and | 182 | /// This data structure is used by the Zig language code generation and |
| 180 | /// therefore must be kept in sync with the compiler implementation. | 183 | /// therefore must be kept in sync with the compiler implementation. |
| 181 | /// TODO: rename to `Type` because "info" is redundant. | 184 | pub const Type = union(enum) { |
| 182 | pub const TypeInfo = union(enum) { | ||
| 183 | Type: void, | 185 | Type: void, |
| 184 | Void: void, | 186 | Void: void, |
| 185 | Bool: void, | 187 | Bool: void, |
lib/std/enums.zig+3-3| ... | @@ -3,14 +3,14 @@ | ... | @@ -3,14 +3,14 @@ |
| 3 | const std = @import("std.zig"); | 3 | const std = @import("std.zig"); |
| 4 | const assert = std.debug.assert; | 4 | const assert = std.debug.assert; |
| 5 | const testing = std.testing; | 5 | const testing = std.testing; |
| 6 | const EnumField = std.builtin.TypeInfo.EnumField; | 6 | const EnumField = std.builtin.Type.EnumField; |
| 7 | 7 | ||
| 8 | /// Returns a struct with a field matching each unique named enum element. | 8 | /// Returns a struct with a field matching each unique named enum element. |
| 9 | /// If the enum is extern and has multiple names for the same value, only | 9 | /// If the enum is extern and has multiple names for the same value, only |
| 10 | /// the first name is used. Each field is of type Data and has the provided | 10 | /// the first name is used. Each field is of type Data and has the provided |
| 11 | /// default, which may be undefined. | 11 | /// default, which may be undefined. |
| 12 | pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_default: ?Data) type { | 12 | pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_default: ?Data) type { |
| 13 | const StructField = std.builtin.TypeInfo.StructField; | 13 | const StructField = std.builtin.Type.StructField; |
| 14 | var fields: []const StructField = &[_]StructField{}; | 14 | var fields: []const StructField = &[_]StructField{}; |
| 15 | for (std.meta.fields(E)) |field| { | 15 | for (std.meta.fields(E)) |field| { |
| 16 | fields = fields ++ &[_]StructField{.{ | 16 | fields = fields ++ &[_]StructField{.{ |
| ... | @@ -24,7 +24,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def | ... | @@ -24,7 +24,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def |
| 24 | return @Type(.{ .Struct = .{ | 24 | return @Type(.{ .Struct = .{ |
| 25 | .layout = .Auto, | 25 | .layout = .Auto, |
| 26 | .fields = fields, | 26 | .fields = fields, |
| 27 | .decls = &[_]std.builtin.TypeInfo.Declaration{}, | 27 | .decls = &.{}, |
| 28 | .is_tuple = false, | 28 | .is_tuple = false, |
| 29 | } }); | 29 | } }); |
| 30 | } | 30 | } |
lib/std/hash/auto_hash.zig+1-1| ... | @@ -233,7 +233,7 @@ fn testHashDeepRecursive(key: anytype) u64 { | ... | @@ -233,7 +233,7 @@ fn testHashDeepRecursive(key: anytype) u64 { |
| 233 | 233 | ||
| 234 | test "typeContainsSlice" { | 234 | test "typeContainsSlice" { |
| 235 | comptime { | 235 | comptime { |
| 236 | try testing.expect(!typeContainsSlice(meta.Tag(std.builtin.TypeInfo))); | 236 | try testing.expect(!typeContainsSlice(meta.Tag(std.builtin.Type))); |
| 237 | 237 | ||
| 238 | try testing.expect(typeContainsSlice([]const u8)); | 238 | try testing.expect(typeContainsSlice([]const u8)); |
| 239 | try testing.expect(!typeContainsSlice(u8)); | 239 | try testing.expect(!typeContainsSlice(u8)); |
lib/std/io/fixed_buffer_stream.zig+1-1| ... | @@ -120,7 +120,7 @@ pub fn fixedBufferStream(buffer: anytype) FixedBufferStream(NonSentinelSpan(@Typ | ... | @@ -120,7 +120,7 @@ pub fn fixedBufferStream(buffer: anytype) FixedBufferStream(NonSentinelSpan(@Typ |
| 120 | fn NonSentinelSpan(comptime T: type) type { | 120 | fn NonSentinelSpan(comptime T: type) type { |
| 121 | var ptr_info = @typeInfo(mem.Span(T)).Pointer; | 121 | var ptr_info = @typeInfo(mem.Span(T)).Pointer; |
| 122 | ptr_info.sentinel = null; | 122 | ptr_info.sentinel = null; |
| 123 | return @Type(std.builtin.TypeInfo{ .Pointer = ptr_info }); | 123 | return @Type(.{ .Pointer = ptr_info }); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | test "FixedBufferStream output" { | 126 | test "FixedBufferStream output" { |
lib/std/io/reader.zig+1-1| ... | @@ -314,7 +314,7 @@ pub fn Reader( | ... | @@ -314,7 +314,7 @@ pub fn Reader( |
| 314 | 314 | ||
| 315 | pub fn readStruct(self: Self, comptime T: type) !T { | 315 | pub fn readStruct(self: Self, comptime T: type) !T { |
| 316 | // Only extern and packed structs have defined in-memory layout. | 316 | // Only extern and packed structs have defined in-memory layout. |
| 317 | comptime assert(@typeInfo(T).Struct.layout != std.builtin.TypeInfo.ContainerLayout.Auto); | 317 | comptime assert(@typeInfo(T).Struct.layout != .Auto); |
| 318 | var res: [1]T = undefined; | 318 | var res: [1]T = undefined; |
| 319 | try self.readNoEof(mem.sliceAsBytes(res[0..])); | 319 | try self.readNoEof(mem.sliceAsBytes(res[0..])); |
| 320 | return res[0]; | 320 | return res[0]; |
lib/std/io/writer.zig+1-1| ... | @@ -84,7 +84,7 @@ pub fn Writer( | ... | @@ -84,7 +84,7 @@ pub fn Writer( |
| 84 | 84 | ||
| 85 | pub fn writeStruct(self: Self, value: anytype) Error!void { | 85 | pub fn writeStruct(self: Self, value: anytype) Error!void { |
| 86 | // Only extern and packed structs have defined in-memory layout. | 86 | // Only extern and packed structs have defined in-memory layout. |
| 87 | comptime assert(@typeInfo(@TypeOf(value)).Struct.layout != std.builtin.TypeInfo.ContainerLayout.Auto); | 87 | comptime assert(@typeInfo(@TypeOf(value)).Struct.layout != .Auto); |
| 88 | return self.writeAll(mem.asBytes(&value)); | 88 | return self.writeAll(mem.asBytes(&value)); |
| 89 | } | 89 | } |
| 90 | }; | 90 | }; |
lib/std/json.zig+1-2| ... | @@ -138,11 +138,10 @@ const AggregateContainerType = enum(u1) { object, array }; | ... | @@ -138,11 +138,10 @@ const AggregateContainerType = enum(u1) { object, array }; |
| 138 | fn AggregateContainerStack(comptime n: usize) type { | 138 | fn AggregateContainerStack(comptime n: usize) type { |
| 139 | return struct { | 139 | return struct { |
| 140 | const Self = @This(); | 140 | const Self = @This(); |
| 141 | const TypeInfo = std.builtin.TypeInfo; | ||
| 142 | 141 | ||
| 143 | const element_bitcount = 8 * @sizeOf(usize); | 142 | const element_bitcount = 8 * @sizeOf(usize); |
| 144 | const element_count = n / element_bitcount; | 143 | const element_count = n / element_bitcount; |
| 145 | const ElementType = @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .unsigned, .bits = element_bitcount } }); | 144 | const ElementType = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = element_bitcount } }); |
| 146 | const ElementShiftAmountType = std.math.Log2Int(ElementType); | 145 | const ElementShiftAmountType = std.math.Log2Int(ElementType); |
| 147 | 146 | ||
| 148 | comptime { | 147 | comptime { |
lib/std/mem.zig+3-3| ... | @@ -608,7 +608,7 @@ pub fn Span(comptime T: type) type { | ... | @@ -608,7 +608,7 @@ pub fn Span(comptime T: type) type { |
| 608 | .Many, .Slice => {}, | 608 | .Many, .Slice => {}, |
| 609 | } | 609 | } |
| 610 | new_ptr_info.size = .Slice; | 610 | new_ptr_info.size = .Slice; |
| 611 | return @Type(std.builtin.TypeInfo{ .Pointer = new_ptr_info }); | 611 | return @Type(.{ .Pointer = new_ptr_info }); |
| 612 | }, | 612 | }, |
| 613 | else => @compileError("invalid type given to std.mem.Span"), | 613 | else => @compileError("invalid type given to std.mem.Span"), |
| 614 | } | 614 | } |
| ... | @@ -720,7 +720,7 @@ fn SliceTo(comptime T: type, comptime end: meta.Elem(T)) type { | ... | @@ -720,7 +720,7 @@ fn SliceTo(comptime T: type, comptime end: meta.Elem(T)) type { |
| 720 | new_ptr_info.is_allowzero = false; | 720 | new_ptr_info.is_allowzero = false; |
| 721 | }, | 721 | }, |
| 722 | } | 722 | } |
| 723 | return @Type(std.builtin.TypeInfo{ .Pointer = new_ptr_info }); | 723 | return @Type(.{ .Pointer = new_ptr_info }); |
| 724 | }, | 724 | }, |
| 725 | else => {}, | 725 | else => {}, |
| 726 | } | 726 | } |
| ... | @@ -2588,7 +2588,7 @@ test "alignPointer" { | ... | @@ -2588,7 +2588,7 @@ test "alignPointer" { |
| 2588 | 2588 | ||
| 2589 | fn CopyPtrAttrs( | 2589 | fn CopyPtrAttrs( |
| 2590 | comptime source: type, | 2590 | comptime source: type, |
| 2591 | comptime size: std.builtin.TypeInfo.Pointer.Size, | 2591 | comptime size: std.builtin.Type.Pointer.Size, |
| 2592 | comptime child: type, | 2592 | comptime child: type, |
| 2593 | ) type { | 2593 | ) type { |
| 2594 | const info = @typeInfo(source).Pointer; | 2594 | const info = @typeInfo(source).Pointer; |
lib/std/meta.zig+34-34| ... | @@ -8,7 +8,7 @@ const root = @import("root"); | ... | @@ -8,7 +8,7 @@ const root = @import("root"); |
| 8 | pub const trait = @import("meta/trait.zig"); | 8 | pub const trait = @import("meta/trait.zig"); |
| 9 | pub const TrailerFlags = @import("meta/trailer_flags.zig").TrailerFlags; | 9 | pub const TrailerFlags = @import("meta/trailer_flags.zig").TrailerFlags; |
| 10 | 10 | ||
| 11 | const TypeInfo = std.builtin.TypeInfo; | 11 | const Type = std.builtin.Type; |
| 12 | 12 | ||
| 13 | pub fn tagName(v: anytype) []const u8 { | 13 | pub fn tagName(v: anytype) []const u8 { |
| 14 | const T = @TypeOf(v); | 14 | const T = @TypeOf(v); |
| ... | @@ -335,7 +335,7 @@ test "std.meta.assumeSentinel" { | ... | @@ -335,7 +335,7 @@ test "std.meta.assumeSentinel" { |
| 335 | try testing.expect(?[*:0]u8 == @TypeOf(assumeSentinel(@as(?[*]u8, undefined), 0))); | 335 | try testing.expect(?[*:0]u8 == @TypeOf(assumeSentinel(@as(?[*]u8, undefined), 0))); |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | pub fn containerLayout(comptime T: type) TypeInfo.ContainerLayout { | 338 | pub fn containerLayout(comptime T: type) Type.ContainerLayout { |
| 339 | return switch (@typeInfo(T)) { | 339 | return switch (@typeInfo(T)) { |
| 340 | .Struct => |info| info.layout, | 340 | .Struct => |info| info.layout, |
| 341 | .Enum => |info| info.layout, | 341 | .Enum => |info| info.layout, |
| ... | @@ -370,9 +370,9 @@ test "std.meta.containerLayout" { | ... | @@ -370,9 +370,9 @@ test "std.meta.containerLayout" { |
| 370 | try testing.expect(containerLayout(U3) == .Extern); | 370 | try testing.expect(containerLayout(U3) == .Extern); |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | /// Instead of this function, prefer to use e.g. `@TypeInfo(foo).Struct.decls` | 373 | /// Instead of this function, prefer to use e.g. `@typeInfo(foo).Struct.decls` |
| 374 | /// directly when you know what kind of type it is. | 374 | /// directly when you know what kind of type it is. |
| 375 | pub fn declarations(comptime T: type) []const TypeInfo.Declaration { | 375 | pub fn declarations(comptime T: type) []const Type.Declaration { |
| 376 | return switch (@typeInfo(T)) { | 376 | return switch (@typeInfo(T)) { |
| 377 | .Struct => |info| info.decls, | 377 | .Struct => |info| info.decls, |
| 378 | .Enum => |info| info.decls, | 378 | .Enum => |info| info.decls, |
| ... | @@ -400,7 +400,7 @@ test "std.meta.declarations" { | ... | @@ -400,7 +400,7 @@ test "std.meta.declarations" { |
| 400 | fn a() void {} | 400 | fn a() void {} |
| 401 | }; | 401 | }; |
| 402 | 402 | ||
| 403 | const decls = comptime [_][]const TypeInfo.Declaration{ | 403 | const decls = comptime [_][]const Type.Declaration{ |
| 404 | declarations(E1), | 404 | declarations(E1), |
| 405 | declarations(S1), | 405 | declarations(S1), |
| 406 | declarations(U1), | 406 | declarations(U1), |
| ... | @@ -413,7 +413,7 @@ test "std.meta.declarations" { | ... | @@ -413,7 +413,7 @@ test "std.meta.declarations" { |
| 413 | } | 413 | } |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | pub fn declarationInfo(comptime T: type, comptime decl_name: []const u8) TypeInfo.Declaration { | 416 | pub fn declarationInfo(comptime T: type, comptime decl_name: []const u8) Type.Declaration { |
| 417 | inline for (comptime declarations(T)) |decl| { | 417 | inline for (comptime declarations(T)) |decl| { |
| 418 | if (comptime mem.eql(u8, decl.name, decl_name)) | 418 | if (comptime mem.eql(u8, decl.name, decl_name)) |
| 419 | return decl; | 419 | return decl; |
| ... | @@ -437,7 +437,7 @@ test "std.meta.declarationInfo" { | ... | @@ -437,7 +437,7 @@ test "std.meta.declarationInfo" { |
| 437 | fn a() void {} | 437 | fn a() void {} |
| 438 | }; | 438 | }; |
| 439 | 439 | ||
| 440 | const infos = comptime [_]TypeInfo.Declaration{ | 440 | const infos = comptime [_]Type.Declaration{ |
| 441 | declarationInfo(E1, "a"), | 441 | declarationInfo(E1, "a"), |
| 442 | declarationInfo(S1, "a"), | 442 | declarationInfo(S1, "a"), |
| 443 | declarationInfo(U1, "a"), | 443 | declarationInfo(U1, "a"), |
| ... | @@ -450,10 +450,10 @@ test "std.meta.declarationInfo" { | ... | @@ -450,10 +450,10 @@ test "std.meta.declarationInfo" { |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | pub fn fields(comptime T: type) switch (@typeInfo(T)) { | 452 | pub fn fields(comptime T: type) switch (@typeInfo(T)) { |
| 453 | .Struct => []const TypeInfo.StructField, | 453 | .Struct => []const Type.StructField, |
| 454 | .Union => []const TypeInfo.UnionField, | 454 | .Union => []const Type.UnionField, |
| 455 | .ErrorSet => []const TypeInfo.Error, | 455 | .ErrorSet => []const Type.Error, |
| 456 | .Enum => []const TypeInfo.EnumField, | 456 | .Enum => []const Type.EnumField, |
| 457 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), | 457 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), |
| 458 | } { | 458 | } { |
| 459 | return switch (@typeInfo(T)) { | 459 | return switch (@typeInfo(T)) { |
| ... | @@ -495,10 +495,10 @@ test "std.meta.fields" { | ... | @@ -495,10 +495,10 @@ test "std.meta.fields" { |
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) { | 497 | pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) { |
| 498 | .Struct => TypeInfo.StructField, | 498 | .Struct => Type.StructField, |
| 499 | .Union => TypeInfo.UnionField, | 499 | .Union => Type.UnionField, |
| 500 | .ErrorSet => TypeInfo.Error, | 500 | .ErrorSet => Type.Error, |
| 501 | .Enum => TypeInfo.EnumField, | 501 | .Enum => Type.EnumField, |
| 502 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), | 502 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), |
| 503 | } { | 503 | } { |
| 504 | return fields(T)[@enumToInt(field)]; | 504 | return fields(T)[@enumToInt(field)]; |
| ... | @@ -570,8 +570,8 @@ test "std.meta.fieldNames" { | ... | @@ -570,8 +570,8 @@ test "std.meta.fieldNames" { |
| 570 | 570 | ||
| 571 | pub fn FieldEnum(comptime T: type) type { | 571 | pub fn FieldEnum(comptime T: type) type { |
| 572 | const fieldInfos = fields(T); | 572 | const fieldInfos = fields(T); |
| 573 | var enumFields: [fieldInfos.len]std.builtin.TypeInfo.EnumField = undefined; | 573 | var enumFields: [fieldInfos.len]std.builtin.Type.EnumField = undefined; |
| 574 | var decls = [_]std.builtin.TypeInfo.Declaration{}; | 574 | var decls = [_]std.builtin.Type.Declaration{}; |
| 575 | inline for (fieldInfos) |field, i| { | 575 | inline for (fieldInfos) |field, i| { |
| 576 | enumFields[i] = .{ | 576 | enumFields[i] = .{ |
| 577 | .name = field.name, | 577 | .name = field.name, |
| ... | @@ -594,8 +594,8 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void { | ... | @@ -594,8 +594,8 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void { |
| 594 | // testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum); | 594 | // testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum); |
| 595 | try testing.expectEqual(@typeInfo(expected).Enum.layout, @typeInfo(actual).Enum.layout); | 595 | try testing.expectEqual(@typeInfo(expected).Enum.layout, @typeInfo(actual).Enum.layout); |
| 596 | try testing.expectEqual(@typeInfo(expected).Enum.tag_type, @typeInfo(actual).Enum.tag_type); | 596 | try testing.expectEqual(@typeInfo(expected).Enum.tag_type, @typeInfo(actual).Enum.tag_type); |
| 597 | comptime try testing.expectEqualSlices(std.builtin.TypeInfo.EnumField, @typeInfo(expected).Enum.fields, @typeInfo(actual).Enum.fields); | 597 | comptime try testing.expectEqualSlices(std.builtin.Type.EnumField, @typeInfo(expected).Enum.fields, @typeInfo(actual).Enum.fields); |
| 598 | comptime try testing.expectEqualSlices(std.builtin.TypeInfo.Declaration, @typeInfo(expected).Enum.decls, @typeInfo(actual).Enum.decls); | 598 | comptime try testing.expectEqualSlices(std.builtin.Type.Declaration, @typeInfo(expected).Enum.decls, @typeInfo(actual).Enum.decls); |
| 599 | try testing.expectEqual(@typeInfo(expected).Enum.is_exhaustive, @typeInfo(actual).Enum.is_exhaustive); | 599 | try testing.expectEqual(@typeInfo(expected).Enum.is_exhaustive, @typeInfo(actual).Enum.is_exhaustive); |
| 600 | } | 600 | } |
| 601 | 601 | ||
| ... | @@ -607,8 +607,8 @@ test "std.meta.FieldEnum" { | ... | @@ -607,8 +607,8 @@ test "std.meta.FieldEnum" { |
| 607 | 607 | ||
| 608 | pub fn DeclEnum(comptime T: type) type { | 608 | pub fn DeclEnum(comptime T: type) type { |
| 609 | const fieldInfos = std.meta.declarations(T); | 609 | const fieldInfos = std.meta.declarations(T); |
| 610 | var enumDecls: [fieldInfos.len]std.builtin.TypeInfo.EnumField = undefined; | 610 | var enumDecls: [fieldInfos.len]std.builtin.Type.EnumField = undefined; |
| 611 | var decls = [_]std.builtin.TypeInfo.Declaration{}; | 611 | var decls = [_]std.builtin.Type.Declaration{}; |
| 612 | inline for (fieldInfos) |field, i| { | 612 | inline for (fieldInfos) |field, i| { |
| 613 | enumDecls[i] = .{ .name = field.name, .value = i }; | 613 | enumDecls[i] = .{ .name = field.name, .value = i }; |
| 614 | } | 614 | } |
| ... | @@ -909,7 +909,7 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De | ... | @@ -909,7 +909,7 @@ pub fn declList(comptime Namespace: type, comptime Decl: type) []const *const De |
| 909 | pub const IntType = @compileError("replaced by std.meta.Int"); | 909 | pub const IntType = @compileError("replaced by std.meta.Int"); |
| 910 | 910 | ||
| 911 | pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type { | 911 | pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type { |
| 912 | return @Type(TypeInfo{ | 912 | return @Type(.{ |
| 913 | .Int = .{ | 913 | .Int = .{ |
| 914 | .signedness = signedness, | 914 | .signedness = signedness, |
| 915 | .bits = bit_count, | 915 | .bits = bit_count, |
| ... | @@ -918,7 +918,7 @@ pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) | ... | @@ -918,7 +918,7 @@ pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) |
| 918 | } | 918 | } |
| 919 | 919 | ||
| 920 | pub fn Float(comptime bit_count: u8) type { | 920 | pub fn Float(comptime bit_count: u8) type { |
| 921 | return @Type(TypeInfo{ | 921 | return @Type(.{ |
| 922 | .Float = .{ .bits = bit_count }, | 922 | .Float = .{ .bits = bit_count }, |
| 923 | }); | 923 | }); |
| 924 | } | 924 | } |
| ... | @@ -931,7 +931,7 @@ test "std.meta.Float" { | ... | @@ -931,7 +931,7 @@ test "std.meta.Float" { |
| 931 | } | 931 | } |
| 932 | 932 | ||
| 933 | pub fn Vector(comptime len: u32, comptime child: type) type { | 933 | pub fn Vector(comptime len: u32, comptime child: type) type { |
| 934 | return @Type(TypeInfo{ | 934 | return @Type(.{ |
| 935 | .Vector = .{ | 935 | .Vector = .{ |
| 936 | .len = len, | 936 | .len = len, |
| 937 | .child = child, | 937 | .child = child, |
| ... | @@ -957,12 +957,12 @@ pub fn ArgsTuple(comptime Function: type) type { | ... | @@ -957,12 +957,12 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 957 | if (function_info.is_var_args) | 957 | if (function_info.is_var_args) |
| 958 | @compileError("Cannot create ArgsTuple for variadic function"); | 958 | @compileError("Cannot create ArgsTuple for variadic function"); |
| 959 | 959 | ||
| 960 | var argument_field_list: [function_info.args.len]std.builtin.TypeInfo.StructField = undefined; | 960 | var argument_field_list: [function_info.args.len]std.builtin.Type.StructField = undefined; |
| 961 | inline for (function_info.args) |arg, i| { | 961 | inline for (function_info.args) |arg, i| { |
| 962 | const T = arg.arg_type.?; | 962 | const T = arg.arg_type.?; |
| 963 | @setEvalBranchQuota(10_000); | 963 | @setEvalBranchQuota(10_000); |
| 964 | var num_buf: [128]u8 = undefined; | 964 | var num_buf: [128]u8 = undefined; |
| 965 | argument_field_list[i] = std.builtin.TypeInfo.StructField{ | 965 | argument_field_list[i] = .{ |
| 966 | .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable, | 966 | .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable, |
| 967 | .field_type = T, | 967 | .field_type = T, |
| 968 | .default_value = @as(?T, null), | 968 | .default_value = @as(?T, null), |
| ... | @@ -971,11 +971,11 @@ pub fn ArgsTuple(comptime Function: type) type { | ... | @@ -971,11 +971,11 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 971 | }; | 971 | }; |
| 972 | } | 972 | } |
| 973 | 973 | ||
| 974 | return @Type(std.builtin.TypeInfo{ | 974 | return @Type(.{ |
| 975 | .Struct = std.builtin.TypeInfo.Struct{ | 975 | .Struct = .{ |
| 976 | .is_tuple = true, | 976 | .is_tuple = true, |
| 977 | .layout = .Auto, | 977 | .layout = .Auto, |
| 978 | .decls = &[_]std.builtin.TypeInfo.Declaration{}, | 978 | .decls = &.{}, |
| 979 | .fields = &argument_field_list, | 979 | .fields = &argument_field_list, |
| 980 | }, | 980 | }, |
| 981 | }); | 981 | }); |
| ... | @@ -989,11 +989,11 @@ pub fn ArgsTuple(comptime Function: type) type { | ... | @@ -989,11 +989,11 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 989 | /// - `Tuple(&[_]type {f32})` ⇒ `tuple { f32 }` | 989 | /// - `Tuple(&[_]type {f32})` ⇒ `tuple { f32 }` |
| 990 | /// - `Tuple(&[_]type {f32,u32})` ⇒ `tuple { f32, u32 }` | 990 | /// - `Tuple(&[_]type {f32,u32})` ⇒ `tuple { f32, u32 }` |
| 991 | pub fn Tuple(comptime types: []const type) type { | 991 | pub fn Tuple(comptime types: []const type) type { |
| 992 | var tuple_fields: [types.len]std.builtin.TypeInfo.StructField = undefined; | 992 | var tuple_fields: [types.len]std.builtin.Type.StructField = undefined; |
| 993 | inline for (types) |T, i| { | 993 | inline for (types) |T, i| { |
| 994 | @setEvalBranchQuota(10_000); | 994 | @setEvalBranchQuota(10_000); |
| 995 | var num_buf: [128]u8 = undefined; | 995 | var num_buf: [128]u8 = undefined; |
| 996 | tuple_fields[i] = std.builtin.TypeInfo.StructField{ | 996 | tuple_fields[i] = .{ |
| 997 | .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable, | 997 | .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable, |
| 998 | .field_type = T, | 998 | .field_type = T, |
| 999 | .default_value = @as(?T, null), | 999 | .default_value = @as(?T, null), |
| ... | @@ -1002,11 +1002,11 @@ pub fn Tuple(comptime types: []const type) type { | ... | @@ -1002,11 +1002,11 @@ pub fn Tuple(comptime types: []const type) type { |
| 1002 | }; | 1002 | }; |
| 1003 | } | 1003 | } |
| 1004 | 1004 | ||
| 1005 | return @Type(std.builtin.TypeInfo{ | 1005 | return @Type(.{ |
| 1006 | .Struct = std.builtin.TypeInfo.Struct{ | 1006 | .Struct = .{ |
| 1007 | .is_tuple = true, | 1007 | .is_tuple = true, |
| 1008 | .layout = .Auto, | 1008 | .layout = .Auto, |
| 1009 | .decls = &[_]std.builtin.TypeInfo.Declaration{}, | 1009 | .decls = &.{}, |
| 1010 | .fields = &tuple_fields, | 1010 | .fields = &tuple_fields, |
| 1011 | }, | 1011 | }, |
| 1012 | }); | 1012 | }); |
lib/std/meta/trailer_flags.zig+4-4| ... | @@ -3,7 +3,7 @@ const meta = std.meta; | ... | @@ -3,7 +3,7 @@ const meta = std.meta; |
| 3 | const testing = std.testing; | 3 | const testing = std.testing; |
| 4 | const mem = std.mem; | 4 | const mem = std.mem; |
| 5 | const assert = std.debug.assert; | 5 | const assert = std.debug.assert; |
| 6 | const TypeInfo = std.builtin.TypeInfo; | 6 | const Type = std.builtin.Type; |
| 7 | 7 | ||
| 8 | /// This is useful for saving memory when allocating an object that has many | 8 | /// This is useful for saving memory when allocating an object that has many |
| 9 | /// optional components. The optional objects are allocated sequentially in | 9 | /// optional components. The optional objects are allocated sequentially in |
| ... | @@ -19,9 +19,9 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -19,9 +19,9 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 19 | pub const FieldEnum = std.meta.FieldEnum(Fields); | 19 | pub const FieldEnum = std.meta.FieldEnum(Fields); |
| 20 | 20 | ||
| 21 | pub const InitStruct = blk: { | 21 | pub const InitStruct = blk: { |
| 22 | comptime var fields: [bit_count]TypeInfo.StructField = undefined; | 22 | comptime var fields: [bit_count]Type.StructField = undefined; |
| 23 | inline for (@typeInfo(Fields).Struct.fields) |struct_field, i| { | 23 | inline for (@typeInfo(Fields).Struct.fields) |struct_field, i| { |
| 24 | fields[i] = TypeInfo.StructField{ | 24 | fields[i] = Type.StructField{ |
| 25 | .name = struct_field.name, | 25 | .name = struct_field.name, |
| 26 | .field_type = ?struct_field.field_type, | 26 | .field_type = ?struct_field.field_type, |
| 27 | .default_value = @as( | 27 | .default_value = @as( |
| ... | @@ -36,7 +36,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -36,7 +36,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 36 | .Struct = .{ | 36 | .Struct = .{ |
| 37 | .layout = .Auto, | 37 | .layout = .Auto, |
| 38 | .fields = &fields, | 38 | .fields = &fields, |
| 39 | .decls = &[_]TypeInfo.Declaration{}, | 39 | .decls = &.{}, |
| 40 | .is_tuple = false, | 40 | .is_tuple = false, |
| 41 | }, | 41 | }, |
| 42 | }); | 42 | }); |
lib/std/zig/Ast.zig+2-2| ... | @@ -1961,7 +1961,7 @@ fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType { | ... | @@ -1961,7 +1961,7 @@ fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType { |
| 1961 | const token_tags = tree.tokens.items(.tag); | 1961 | const token_tags = tree.tokens.items(.tag); |
| 1962 | // TODO: looks like stage1 isn't quite smart enough to handle enum | 1962 | // TODO: looks like stage1 isn't quite smart enough to handle enum |
| 1963 | // literals in some places here | 1963 | // literals in some places here |
| 1964 | const Size = std.builtin.TypeInfo.Pointer.Size; | 1964 | const Size = std.builtin.Type.Pointer.Size; |
| 1965 | const size: Size = switch (token_tags[info.main_token]) { | 1965 | const size: Size = switch (token_tags[info.main_token]) { |
| 1966 | .asterisk, | 1966 | .asterisk, |
| 1967 | .asterisk_asterisk, | 1967 | .asterisk_asterisk, |
| ... | @@ -2392,7 +2392,7 @@ pub const full = struct { | ... | @@ -2392,7 +2392,7 @@ pub const full = struct { |
| 2392 | }; | 2392 | }; |
| 2393 | 2393 | ||
| 2394 | pub const PtrType = struct { | 2394 | pub const PtrType = struct { |
| 2395 | size: std.builtin.TypeInfo.Pointer.Size, | 2395 | size: std.builtin.Type.Pointer.Size, |
| 2396 | allowzero_token: ?TokenIndex, | 2396 | allowzero_token: ?TokenIndex, |
| 2397 | const_token: ?TokenIndex, | 2397 | const_token: ?TokenIndex, |
| 2398 | volatile_token: ?TokenIndex, | 2398 | volatile_token: ?TokenIndex, |
lib/std/zig/c_translation.zig+1-1| ... | @@ -88,7 +88,7 @@ fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype | ... | @@ -88,7 +88,7 @@ fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype |
| 88 | return @as(DestType, target); | 88 | return @as(DestType, target); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | fn ptrInfo(comptime PtrType: type) std.builtin.TypeInfo.Pointer { | 91 | fn ptrInfo(comptime PtrType: type) std.builtin.Type.Pointer { |
| 92 | return switch (@typeInfo(PtrType)) { | 92 | return switch (@typeInfo(PtrType)) { |
| 93 | .Optional => |opt_info| @typeInfo(opt_info.child).Pointer, | 93 | .Optional => |opt_info| @typeInfo(opt_info.child).Pointer, |
| 94 | .Pointer => |ptr_info| ptr_info, | 94 | .Pointer => |ptr_info| ptr_info, |
src/AstGen.zig+10-10| ... | @@ -3940,7 +3940,7 @@ fn structDeclInner( | ... | @@ -3940,7 +3940,7 @@ fn structDeclInner( |
| 3940 | scope: *Scope, | 3940 | scope: *Scope, |
| 3941 | node: Ast.Node.Index, | 3941 | node: Ast.Node.Index, |
| 3942 | container_decl: Ast.full.ContainerDecl, | 3942 | container_decl: Ast.full.ContainerDecl, |
| 3943 | layout: std.builtin.TypeInfo.ContainerLayout, | 3943 | layout: std.builtin.Type.ContainerLayout, |
| 3944 | ) InnerError!Zir.Inst.Ref { | 3944 | ) InnerError!Zir.Inst.Ref { |
| 3945 | const decl_inst = try gz.reserveInstructionIndex(); | 3945 | const decl_inst = try gz.reserveInstructionIndex(); |
| 3946 | 3946 | ||
| ... | @@ -4076,7 +4076,7 @@ fn unionDeclInner( | ... | @@ -4076,7 +4076,7 @@ fn unionDeclInner( |
| 4076 | scope: *Scope, | 4076 | scope: *Scope, |
| 4077 | node: Ast.Node.Index, | 4077 | node: Ast.Node.Index, |
| 4078 | members: []const Ast.Node.Index, | 4078 | members: []const Ast.Node.Index, |
| 4079 | layout: std.builtin.TypeInfo.ContainerLayout, | 4079 | layout: std.builtin.Type.ContainerLayout, |
| 4080 | arg_node: Ast.Node.Index, | 4080 | arg_node: Ast.Node.Index, |
| 4081 | have_auto_enum: bool, | 4081 | have_auto_enum: bool, |
| 4082 | ) InnerError!Zir.Inst.Ref { | 4082 | ) InnerError!Zir.Inst.Ref { |
| ... | @@ -4242,10 +4242,10 @@ fn containerDecl( | ... | @@ -4242,10 +4242,10 @@ fn containerDecl( |
| 4242 | switch (token_tags[container_decl.ast.main_token]) { | 4242 | switch (token_tags[container_decl.ast.main_token]) { |
| 4243 | .keyword_struct => { | 4243 | .keyword_struct => { |
| 4244 | const layout = if (container_decl.layout_token) |t| switch (token_tags[t]) { | 4244 | const layout = if (container_decl.layout_token) |t| switch (token_tags[t]) { |
| 4245 | .keyword_packed => std.builtin.TypeInfo.ContainerLayout.Packed, | 4245 | .keyword_packed => std.builtin.Type.ContainerLayout.Packed, |
| 4246 | .keyword_extern => std.builtin.TypeInfo.ContainerLayout.Extern, | 4246 | .keyword_extern => std.builtin.Type.ContainerLayout.Extern, |
| 4247 | else => unreachable, | 4247 | else => unreachable, |
| 4248 | } else std.builtin.TypeInfo.ContainerLayout.Auto; | 4248 | } else std.builtin.Type.ContainerLayout.Auto; |
| 4249 | 4249 | ||
| 4250 | assert(container_decl.ast.arg == 0); | 4250 | assert(container_decl.ast.arg == 0); |
| 4251 | 4251 | ||
| ... | @@ -4254,10 +4254,10 @@ fn containerDecl( | ... | @@ -4254,10 +4254,10 @@ fn containerDecl( |
| 4254 | }, | 4254 | }, |
| 4255 | .keyword_union => { | 4255 | .keyword_union => { |
| 4256 | const layout = if (container_decl.layout_token) |t| switch (token_tags[t]) { | 4256 | const layout = if (container_decl.layout_token) |t| switch (token_tags[t]) { |
| 4257 | .keyword_packed => std.builtin.TypeInfo.ContainerLayout.Packed, | 4257 | .keyword_packed => std.builtin.Type.ContainerLayout.Packed, |
| 4258 | .keyword_extern => std.builtin.TypeInfo.ContainerLayout.Extern, | 4258 | .keyword_extern => std.builtin.Type.ContainerLayout.Extern, |
| 4259 | else => unreachable, | 4259 | else => unreachable, |
| 4260 | } else std.builtin.TypeInfo.ContainerLayout.Auto; | 4260 | } else std.builtin.Type.ContainerLayout.Auto; |
| 4261 | 4261 | ||
| 4262 | const have_auto_enum = container_decl.ast.enum_token != null; | 4262 | const have_auto_enum = container_decl.ast.enum_token != null; |
| 4263 | 4263 | ||
| ... | @@ -10495,7 +10495,7 @@ const GenZir = struct { | ... | @@ -10495,7 +10495,7 @@ const GenZir = struct { |
| 10495 | body_len: u32, | 10495 | body_len: u32, |
| 10496 | fields_len: u32, | 10496 | fields_len: u32, |
| 10497 | decls_len: u32, | 10497 | decls_len: u32, |
| 10498 | layout: std.builtin.TypeInfo.ContainerLayout, | 10498 | layout: std.builtin.Type.ContainerLayout, |
| 10499 | known_non_opv: bool, | 10499 | known_non_opv: bool, |
| 10500 | known_comptime_only: bool, | 10500 | known_comptime_only: bool, |
| 10501 | }) !void { | 10501 | }) !void { |
| ... | @@ -10543,7 +10543,7 @@ const GenZir = struct { | ... | @@ -10543,7 +10543,7 @@ const GenZir = struct { |
| 10543 | body_len: u32, | 10543 | body_len: u32, |
| 10544 | fields_len: u32, | 10544 | fields_len: u32, |
| 10545 | decls_len: u32, | 10545 | decls_len: u32, |
| 10546 | layout: std.builtin.TypeInfo.ContainerLayout, | 10546 | layout: std.builtin.Type.ContainerLayout, |
| 10547 | auto_enum_tag: bool, | 10547 | auto_enum_tag: bool, |
| 10548 | }) !void { | 10548 | }) !void { |
| 10549 | const astgen = gz.astgen; | 10549 | const astgen = gz.astgen; |
src/InternArena.zig+1-1| ... | @@ -30,7 +30,7 @@ pub const Key = union(enum) { | ... | @@ -30,7 +30,7 @@ pub const Key = union(enum) { |
| 30 | elem_type: Index, | 30 | elem_type: Index, |
| 31 | sentinel: Index, | 31 | sentinel: Index, |
| 32 | alignment: u16, | 32 | alignment: u16, |
| 33 | size: std.builtin.TypeInfo.Pointer.Size, | 33 | size: std.builtin.Type.Pointer.Size, |
| 34 | is_const: bool, | 34 | is_const: bool, |
| 35 | is_volatile: bool, | 35 | is_volatile: bool, |
| 36 | is_allowzero: bool, | 36 | is_allowzero: bool, |
src/Module.zig+2-2| ... | @@ -853,7 +853,7 @@ pub const Struct = struct { | ... | @@ -853,7 +853,7 @@ pub const Struct = struct { |
| 853 | /// Index of the struct_decl ZIR instruction. | 853 | /// Index of the struct_decl ZIR instruction. |
| 854 | zir_index: Zir.Inst.Index, | 854 | zir_index: Zir.Inst.Index, |
| 855 | 855 | ||
| 856 | layout: std.builtin.TypeInfo.ContainerLayout, | 856 | layout: std.builtin.Type.ContainerLayout, |
| 857 | status: enum { | 857 | status: enum { |
| 858 | none, | 858 | none, |
| 859 | field_types_wip, | 859 | field_types_wip, |
| ... | @@ -1105,7 +1105,7 @@ pub const Union = struct { | ... | @@ -1105,7 +1105,7 @@ pub const Union = struct { |
| 1105 | /// Index of the union_decl ZIR instruction. | 1105 | /// Index of the union_decl ZIR instruction. |
| 1106 | zir_index: Zir.Inst.Index, | 1106 | zir_index: Zir.Inst.Index, |
| 1107 | 1107 | ||
| 1108 | layout: std.builtin.TypeInfo.ContainerLayout, | 1108 | layout: std.builtin.Type.ContainerLayout, |
| 1109 | status: enum { | 1109 | status: enum { |
| 1110 | none, | 1110 | none, |
| 1111 | field_types_wip, | 1111 | field_types_wip, |
src/Sema.zig+6-6| ... | @@ -10068,7 +10068,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -10068,7 +10068,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 10068 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 10068 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 10069 | const src = inst_data.src(); | 10069 | const src = inst_data.src(); |
| 10070 | const ty = try sema.resolveType(block, src, inst_data.operand); | 10070 | const ty = try sema.resolveType(block, src, inst_data.operand); |
| 10071 | const type_info_ty = try sema.getBuiltinType(block, src, "TypeInfo"); | 10071 | const type_info_ty = try sema.getBuiltinType(block, src, "Type"); |
| 10072 | const target = sema.mod.getTarget(); | 10072 | const target = sema.mod.getTarget(); |
| 10073 | 10073 | ||
| 10074 | switch (ty.zigTypeTag()) { | 10074 | switch (ty.zigTypeTag()) { |
| ... | @@ -10413,7 +10413,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -10413,7 +10413,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 10413 | break :v try Value.Tag.opt_payload.create(sema.arena, slice_val); | 10413 | break :v try Value.Tag.opt_payload.create(sema.arena, slice_val); |
| 10414 | } else Value.@"null"; | 10414 | } else Value.@"null"; |
| 10415 | 10415 | ||
| 10416 | // Construct TypeInfo{ .ErrorSet = errors_val } | 10416 | // Construct Type{ .ErrorSet = errors_val } |
| 10417 | return sema.addConstant( | 10417 | return sema.addConstant( |
| 10418 | type_info_ty, | 10418 | type_info_ty, |
| 10419 | try Value.Tag.@"union".create(sema.arena, .{ | 10419 | try Value.Tag.@"union".create(sema.arena, .{ |
| ... | @@ -10516,7 +10516,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -10516,7 +10516,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 10516 | // layout: ContainerLayout, | 10516 | // layout: ContainerLayout, |
| 10517 | try Value.Tag.enum_field_index.create( | 10517 | try Value.Tag.enum_field_index.create( |
| 10518 | sema.arena, | 10518 | sema.arena, |
| 10519 | @enumToInt(std.builtin.TypeInfo.ContainerLayout.Auto), | 10519 | @enumToInt(std.builtin.Type.ContainerLayout.Auto), |
| 10520 | ), | 10520 | ), |
| 10521 | 10521 | ||
| 10522 | // tag_type: type, | 10522 | // tag_type: type, |
| ... | @@ -12186,7 +12186,7 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -12186,7 +12186,7 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 12186 | fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 12186 | fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12187 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 12187 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 12188 | const src = inst_data.src(); | 12188 | const src = inst_data.src(); |
| 12189 | const type_info_ty = try sema.resolveBuiltinTypeFields(block, src, "TypeInfo"); | 12189 | const type_info_ty = try sema.resolveBuiltinTypeFields(block, src, "Type"); |
| 12190 | const uncasted_operand = sema.resolveInst(inst_data.operand); | 12190 | const uncasted_operand = sema.resolveInst(inst_data.operand); |
| 12191 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; | 12191 | const operand_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = inst_data.src_node }; |
| 12192 | const type_info = try sema.coerce(block, type_info_ty, uncasted_operand, operand_src); | 12192 | const type_info = try sema.coerce(block, type_info_ty, uncasted_operand, operand_src); |
| ... | @@ -12265,7 +12265,7 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -12265,7 +12265,7 @@ fn zirReify(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 12265 | var buffer: Value.ToTypeBuffer = undefined; | 12265 | var buffer: Value.ToTypeBuffer = undefined; |
| 12266 | const child_ty = child_val.toType(&buffer); | 12266 | const child_ty = child_val.toType(&buffer); |
| 12267 | 12267 | ||
| 12268 | const ptr_size = size_val.toEnum(std.builtin.TypeInfo.Pointer.Size); | 12268 | const ptr_size = size_val.toEnum(std.builtin.Type.Pointer.Size); |
| 12269 | 12269 | ||
| 12270 | var actual_sentinel: ?Value = null; | 12270 | var actual_sentinel: ?Value = null; |
| 12271 | if (!sentinel_val.isNull()) { | 12271 | if (!sentinel_val.isNull()) { |
| ... | @@ -18850,7 +18850,7 @@ fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) Comp | ... | @@ -18850,7 +18850,7 @@ fn resolveTypeFields(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) Comp |
| 18850 | try sema.resolveTypeFieldsUnion(block, src, ty, union_obj); | 18850 | try sema.resolveTypeFieldsUnion(block, src, ty, union_obj); |
| 18851 | return ty; | 18851 | return ty; |
| 18852 | }, | 18852 | }, |
| 18853 | .type_info => return sema.resolveBuiltinTypeFields(block, src, "TypeInfo"), | 18853 | .type_info => return sema.resolveBuiltinTypeFields(block, src, "Type"), |
| 18854 | .extern_options => return sema.resolveBuiltinTypeFields(block, src, "ExternOptions"), | 18854 | .extern_options => return sema.resolveBuiltinTypeFields(block, src, "ExternOptions"), |
| 18855 | .export_options => return sema.resolveBuiltinTypeFields(block, src, "ExportOptions"), | 18855 | .export_options => return sema.resolveBuiltinTypeFields(block, src, "ExportOptions"), |
| 18856 | .atomic_order => return sema.resolveBuiltinTypeFields(block, src, "AtomicOrder"), | 18856 | .atomic_order => return sema.resolveBuiltinTypeFields(block, src, "AtomicOrder"), |
src/Zir.zig+4-4| ... | @@ -2157,7 +2157,7 @@ pub const Inst = struct { | ... | @@ -2157,7 +2157,7 @@ pub const Inst = struct { |
| 2157 | is_allowzero: bool, | 2157 | is_allowzero: bool, |
| 2158 | is_mutable: bool, | 2158 | is_mutable: bool, |
| 2159 | is_volatile: bool, | 2159 | is_volatile: bool, |
| 2160 | size: std.builtin.TypeInfo.Pointer.Size, | 2160 | size: std.builtin.Type.Pointer.Size, |
| 2161 | elem_type: Ref, | 2161 | elem_type: Ref, |
| 2162 | }, | 2162 | }, |
| 2163 | ptr_type: struct { | 2163 | ptr_type: struct { |
| ... | @@ -2171,7 +2171,7 @@ pub const Inst = struct { | ... | @@ -2171,7 +2171,7 @@ pub const Inst = struct { |
| 2171 | has_bit_range: bool, | 2171 | has_bit_range: bool, |
| 2172 | _: u1 = undefined, | 2172 | _: u1 = undefined, |
| 2173 | }, | 2173 | }, |
| 2174 | size: std.builtin.TypeInfo.Pointer.Size, | 2174 | size: std.builtin.Type.Pointer.Size, |
| 2175 | /// Index into extra. See `PtrType`. | 2175 | /// Index into extra. See `PtrType`. |
| 2176 | payload_index: u32, | 2176 | payload_index: u32, |
| 2177 | }, | 2177 | }, |
| ... | @@ -2659,7 +2659,7 @@ pub const Inst = struct { | ... | @@ -2659,7 +2659,7 @@ pub const Inst = struct { |
| 2659 | known_non_opv: bool, | 2659 | known_non_opv: bool, |
| 2660 | known_comptime_only: bool, | 2660 | known_comptime_only: bool, |
| 2661 | name_strategy: NameStrategy, | 2661 | name_strategy: NameStrategy, |
| 2662 | layout: std.builtin.TypeInfo.ContainerLayout, | 2662 | layout: std.builtin.Type.ContainerLayout, |
| 2663 | _: u6 = undefined, | 2663 | _: u6 = undefined, |
| 2664 | }; | 2664 | }; |
| 2665 | }; | 2665 | }; |
| ... | @@ -2778,7 +2778,7 @@ pub const Inst = struct { | ... | @@ -2778,7 +2778,7 @@ pub const Inst = struct { |
| 2778 | has_fields_len: bool, | 2778 | has_fields_len: bool, |
| 2779 | has_decls_len: bool, | 2779 | has_decls_len: bool, |
| 2780 | name_strategy: NameStrategy, | 2780 | name_strategy: NameStrategy, |
| 2781 | layout: std.builtin.TypeInfo.ContainerLayout, | 2781 | layout: std.builtin.Type.ContainerLayout, |
| 2782 | /// has_tag_type | auto_enum_tag | result | 2782 | /// has_tag_type | auto_enum_tag | result |
| 2783 | /// ------------------------------------- | 2783 | /// ------------------------------------- |
| 2784 | /// false | false | union { } | 2784 | /// false | false | union { } |
src/stage1/ir.cpp+19-19| ... | @@ -17971,7 +17971,7 @@ static void ensure_field_index(ZigType *type, const char *field_name, size_t ind | ... | @@ -17971,7 +17971,7 @@ static void ensure_field_index(ZigType *type, const char *field_name, size_t ind |
| 17971 | 17971 | ||
| 17972 | static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, ZigType *root) { | 17972 | static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, ZigType *root) { |
| 17973 | Error err; | 17973 | Error err; |
| 17974 | ZigType *type_info_type = get_builtin_type(ira->codegen, "TypeInfo"); | 17974 | ZigType *type_info_type = get_builtin_type(ira->codegen, "Type"); |
| 17975 | assert(type_info_type->id == ZigTypeIdUnion); | 17975 | assert(type_info_type->id == ZigTypeIdUnion); |
| 17976 | if ((err = type_resolve(ira->codegen, type_info_type, ResolveStatusSizeKnown))) { | 17976 | if ((err = type_resolve(ira->codegen, type_info_type, ResolveStatusSizeKnown))) { |
| 17977 | zig_unreachable(); | 17977 | zig_unreachable(); |
| ... | @@ -18403,7 +18403,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18403,7 +18403,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18403 | fields[1]->special = ConstValSpecialStatic; | 18403 | fields[1]->special = ConstValSpecialStatic; |
| 18404 | fields[1]->type = g->builtin_types.entry_type; | 18404 | fields[1]->type = g->builtin_types.entry_type; |
| 18405 | fields[1]->data.x_type = type_entry->data.enumeration.tag_int_type; | 18405 | fields[1]->data.x_type = type_entry->data.enumeration.tag_int_type; |
| 18406 | // fields: []TypeInfo.EnumField | 18406 | // fields: []Type.EnumField |
| 18407 | ensure_field_index(result->type, "fields", 2); | 18407 | ensure_field_index(result->type, "fields", 2); |
| 18408 | 18408 | ||
| 18409 | ZigType *type_info_enum_field_type = ir_type_info_get_type(ira, "EnumField", nullptr); | 18409 | ZigType *type_info_enum_field_type = ir_type_info_get_type(ira, "EnumField", nullptr); |
| ... | @@ -18429,7 +18429,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18429,7 +18429,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18429 | enum_field_val->parent.data.p_array.array_val = enum_field_array; | 18429 | enum_field_val->parent.data.p_array.array_val = enum_field_array; |
| 18430 | enum_field_val->parent.data.p_array.elem_index = enum_field_index; | 18430 | enum_field_val->parent.data.p_array.elem_index = enum_field_index; |
| 18431 | } | 18431 | } |
| 18432 | // decls: []TypeInfo.Declaration | 18432 | // decls: []Type.Declaration |
| 18433 | ensure_field_index(result->type, "decls", 3); | 18433 | ensure_field_index(result->type, "decls", 3); |
| 18434 | if ((err = ir_make_type_info_decls(ira, source_node, fields[3], | 18434 | if ((err = ir_make_type_info_decls(ira, source_node, fields[3], |
| 18435 | type_entry->data.enumeration.decls_scope, false))) | 18435 | type_entry->data.enumeration.decls_scope, false))) |
| ... | @@ -18553,7 +18553,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18553,7 +18553,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18553 | } else { | 18553 | } else { |
| 18554 | fields[1]->data.x_optional = nullptr; | 18554 | fields[1]->data.x_optional = nullptr; |
| 18555 | } | 18555 | } |
| 18556 | // fields: []TypeInfo.UnionField | 18556 | // fields: []Type.UnionField |
| 18557 | ensure_field_index(result->type, "fields", 2); | 18557 | ensure_field_index(result->type, "fields", 2); |
| 18558 | 18558 | ||
| 18559 | ZigType *type_info_union_field_type = ir_type_info_get_type(ira, "UnionField", nullptr); | 18559 | ZigType *type_info_union_field_type = ir_type_info_get_type(ira, "UnionField", nullptr); |
| ... | @@ -18595,7 +18595,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18595,7 +18595,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18595 | union_field_val->parent.data.p_array.array_val = union_field_array; | 18595 | union_field_val->parent.data.p_array.array_val = union_field_array; |
| 18596 | union_field_val->parent.data.p_array.elem_index = union_field_index; | 18596 | union_field_val->parent.data.p_array.elem_index = union_field_index; |
| 18597 | } | 18597 | } |
| 18598 | // decls: []TypeInfo.Declaration | 18598 | // decls: []Type.Declaration |
| 18599 | ensure_field_index(result->type, "decls", 3); | 18599 | ensure_field_index(result->type, "decls", 3); |
| 18600 | if ((err = ir_make_type_info_decls(ira, source_node, fields[3], | 18600 | if ((err = ir_make_type_info_decls(ira, source_node, fields[3], |
| 18601 | type_entry->data.unionation.decls_scope, false))) | 18601 | type_entry->data.unionation.decls_scope, false))) |
| ... | @@ -18629,7 +18629,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18629,7 +18629,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18629 | fields[0]->special = ConstValSpecialStatic; | 18629 | fields[0]->special = ConstValSpecialStatic; |
| 18630 | fields[0]->type = ir_type_info_get_type(ira, "ContainerLayout", nullptr); | 18630 | fields[0]->type = ir_type_info_get_type(ira, "ContainerLayout", nullptr); |
| 18631 | bigint_init_unsigned(&fields[0]->data.x_enum_tag, type_entry->data.structure.layout); | 18631 | bigint_init_unsigned(&fields[0]->data.x_enum_tag, type_entry->data.structure.layout); |
| 18632 | // fields: []TypeInfo.StructField | 18632 | // fields: []Type.StructField |
| 18633 | ensure_field_index(result->type, "fields", 1); | 18633 | ensure_field_index(result->type, "fields", 1); |
| 18634 | 18634 | ||
| 18635 | ZigType *type_info_struct_field_type = ir_type_info_get_type(ira, "StructField", nullptr); | 18635 | ZigType *type_info_struct_field_type = ir_type_info_get_type(ira, "StructField", nullptr); |
| ... | @@ -18690,7 +18690,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18690,7 +18690,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18690 | struct_field_val->parent.data.p_array.array_val = struct_field_array; | 18690 | struct_field_val->parent.data.p_array.array_val = struct_field_array; |
| 18691 | struct_field_val->parent.data.p_array.elem_index = struct_field_index; | 18691 | struct_field_val->parent.data.p_array.elem_index = struct_field_index; |
| 18692 | } | 18692 | } |
| 18693 | // decls: []TypeInfo.Declaration | 18693 | // decls: []Type.Declaration |
| 18694 | ensure_field_index(result->type, "decls", 2); | 18694 | ensure_field_index(result->type, "decls", 2); |
| 18695 | if ((err = ir_make_type_info_decls(ira, source_node, fields[2], | 18695 | if ((err = ir_make_type_info_decls(ira, source_node, fields[2], |
| 18696 | type_entry->data.structure.decls_scope, false))) | 18696 | type_entry->data.structure.decls_scope, false))) |
| ... | @@ -18715,7 +18715,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18715,7 +18715,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18715 | ZigValue **fields = alloc_const_vals_ptrs(g, 7); | 18715 | ZigValue **fields = alloc_const_vals_ptrs(g, 7); |
| 18716 | result->data.x_struct.fields = fields; | 18716 | result->data.x_struct.fields = fields; |
| 18717 | 18717 | ||
| 18718 | // calling_convention: TypeInfo.CallingConvention | 18718 | // calling_convention: Type.CallingConvention |
| 18719 | ensure_field_index(result->type, "calling_convention", 0); | 18719 | ensure_field_index(result->type, "calling_convention", 0); |
| 18720 | fields[0]->special = ConstValSpecialStatic; | 18720 | fields[0]->special = ConstValSpecialStatic; |
| 18721 | fields[0]->type = get_builtin_type(g, "CallingConvention"); | 18721 | fields[0]->type = get_builtin_type(g, "CallingConvention"); |
| ... | @@ -18750,7 +18750,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18750,7 +18750,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18750 | return_type->data.x_type = type_entry->data.fn.fn_type_id.return_type; | 18750 | return_type->data.x_type = type_entry->data.fn.fn_type_id.return_type; |
| 18751 | fields[4]->data.x_optional = return_type; | 18751 | fields[4]->data.x_optional = return_type; |
| 18752 | } | 18752 | } |
| 18753 | // args: []TypeInfo.Fn.Param | 18753 | // args: []Type.Fn.Param |
| 18754 | ZigType *type_info_fn_arg_type = ir_type_info_get_type(ira, "Param", result->type); | 18754 | ZigType *type_info_fn_arg_type = ir_type_info_get_type(ira, "Param", result->type); |
| 18755 | if ((err = type_resolve(g, type_info_fn_arg_type, ResolveStatusSizeKnown))) { | 18755 | if ((err = type_resolve(g, type_info_fn_arg_type, ResolveStatusSizeKnown))) { |
| 18756 | zig_unreachable(); | 18756 | zig_unreachable(); |
| ... | @@ -18821,7 +18821,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour | ... | @@ -18821,7 +18821,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, Scope *scope, AstNode *sour |
| 18821 | ZigValue **fields = alloc_const_vals_ptrs(g, 1); | 18821 | ZigValue **fields = alloc_const_vals_ptrs(g, 1); |
| 18822 | result->data.x_struct.fields = fields; | 18822 | result->data.x_struct.fields = fields; |
| 18823 | 18823 | ||
| 18824 | // decls: []TypeInfo.Declaration | 18824 | // decls: []Type.Declaration |
| 18825 | ensure_field_index(result->type, "decls", 0); | 18825 | ensure_field_index(result->type, "decls", 0); |
| 18826 | if ((err = ir_make_type_info_decls(ira, source_node, fields[0], | 18826 | if ((err = ir_make_type_info_decls(ira, source_node, fields[0], |
| 18827 | type_entry->data.opaque.decls_scope, false))) | 18827 | type_entry->data.opaque.decls_scope, false))) |
| ... | @@ -19194,7 +19194,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19194,7 +19194,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19194 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; | 19194 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; |
| 19195 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); | 19195 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); |
| 19196 | if (decls_len != 0) { | 19196 | if (decls_len != 0) { |
| 19197 | ir_add_error_node(ira, source_node, buf_create_from_str("TypeInfo.Struct.decls must be empty for @Type")); | 19197 | ir_add_error_node(ira, source_node, buf_create_from_str("Type.Struct.decls must be empty for @Type")); |
| 19198 | return ira->codegen->invalid_inst_gen->value->type; | 19198 | return ira->codegen->invalid_inst_gen->value->type; |
| 19199 | } | 19199 | } |
| 19200 | 19200 | ||
| ... | @@ -19311,7 +19311,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19311,7 +19311,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19311 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; | 19311 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; |
| 19312 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); | 19312 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); |
| 19313 | if (decls_len != 0) { | 19313 | if (decls_len != 0) { |
| 19314 | ir_add_error_node(ira, source_node, buf_create_from_str("TypeInfo.Struct.decls must be empty for @Type")); | 19314 | ir_add_error_node(ira, source_node, buf_create_from_str("Type.Struct.decls must be empty for @Type")); |
| 19315 | return ira->codegen->invalid_inst_gen->value->type; | 19315 | return ira->codegen->invalid_inst_gen->value->type; |
| 19316 | } | 19316 | } |
| 19317 | 19317 | ||
| ... | @@ -19395,7 +19395,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19395,7 +19395,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19395 | return ira->codegen->invalid_inst_gen->value->type; | 19395 | return ira->codegen->invalid_inst_gen->value->type; |
| 19396 | if (tag_type->id != ZigTypeIdInt) { | 19396 | if (tag_type->id != ZigTypeIdInt) { |
| 19397 | ir_add_error_node(ira, source_node, buf_sprintf( | 19397 | ir_add_error_node(ira, source_node, buf_sprintf( |
| 19398 | "TypeInfo.Enum.tag_type must be an integer type, not '%s'", buf_ptr(&tag_type->name))); | 19398 | "Type.Enum.tag_type must be an integer type, not '%s'", buf_ptr(&tag_type->name))); |
| 19399 | return ira->codegen->invalid_inst_gen->value->type; | 19399 | return ira->codegen->invalid_inst_gen->value->type; |
| 19400 | } | 19400 | } |
| 19401 | 19401 | ||
| ... | @@ -19418,7 +19418,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19418,7 +19418,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19418 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; | 19418 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; |
| 19419 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); | 19419 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); |
| 19420 | if (decls_len != 0) { | 19420 | if (decls_len != 0) { |
| 19421 | ir_add_error_node(ira, source_node, buf_create_from_str("TypeInfo.Enum.decls must be empty for @Type")); | 19421 | ir_add_error_node(ira, source_node, buf_create_from_str("Type.Enum.decls must be empty for @Type")); |
| 19422 | return ira->codegen->invalid_inst_gen->value->type; | 19422 | return ira->codegen->invalid_inst_gen->value->type; |
| 19423 | } | 19423 | } |
| 19424 | 19424 | ||
| ... | @@ -19505,7 +19505,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19505,7 +19505,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19505 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; | 19505 | ZigValue *decls_len_value = decls_value->data.x_struct.fields[slice_len_index]; |
| 19506 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); | 19506 | size_t decls_len = bigint_as_usize(&decls_len_value->data.x_bigint); |
| 19507 | if (decls_len != 0) { | 19507 | if (decls_len != 0) { |
| 19508 | ir_add_error_node(ira, source_node, buf_create_from_str("TypeInfo.Union.decls must be empty for @Type")); | 19508 | ir_add_error_node(ira, source_node, buf_create_from_str("Type.Union.decls must be empty for @Type")); |
| 19509 | return ira->codegen->invalid_inst_gen->value->type; | 19509 | return ira->codegen->invalid_inst_gen->value->type; |
| 19510 | } | 19510 | } |
| 19511 | 19511 | ||
| ... | @@ -19571,7 +19571,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19571,7 +19571,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19571 | if ((err = get_const_field_bool(ira, source_node, payload, "is_generic", 2, &is_generic))) | 19571 | if ((err = get_const_field_bool(ira, source_node, payload, "is_generic", 2, &is_generic))) |
| 19572 | return ira->codegen->invalid_inst_gen->value->type; | 19572 | return ira->codegen->invalid_inst_gen->value->type; |
| 19573 | if (is_generic) { | 19573 | if (is_generic) { |
| 19574 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.is_generic must be false for @Type")); | 19574 | ir_add_error_node(ira, source_node, buf_sprintf("Type.Fn.is_generic must be false for @Type")); |
| 19575 | return ira->codegen->invalid_inst_gen->value->type; | 19575 | return ira->codegen->invalid_inst_gen->value->type; |
| 19576 | } | 19576 | } |
| 19577 | 19577 | ||
| ... | @@ -19585,7 +19585,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19585,7 +19585,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19585 | 19585 | ||
| 19586 | ZigType *return_type = get_const_field_meta_type_optional(ira, source_node, payload, "return_type", 4); | 19586 | ZigType *return_type = get_const_field_meta_type_optional(ira, source_node, payload, "return_type", 4); |
| 19587 | if (return_type == nullptr) { | 19587 | if (return_type == nullptr) { |
| 19588 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.return_type must be non-null for @Type")); | 19588 | ir_add_error_node(ira, source_node, buf_sprintf("Type.Fn.return_type must be non-null for @Type")); |
| 19589 | return ira->codegen->invalid_inst_gen->value->type; | 19589 | return ira->codegen->invalid_inst_gen->value->type; |
| 19590 | } | 19590 | } |
| 19591 | 19591 | ||
| ... | @@ -19620,7 +19620,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19620,7 +19620,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19620 | if ((err = get_const_field_bool(ira, source_node, arg_value, "is_generic", 0, &is_generic))) | 19620 | if ((err = get_const_field_bool(ira, source_node, arg_value, "is_generic", 0, &is_generic))) |
| 19621 | return ira->codegen->invalid_inst_gen->value->type; | 19621 | return ira->codegen->invalid_inst_gen->value->type; |
| 19622 | if (is_generic) { | 19622 | if (is_generic) { |
| 19623 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.Param.is_generic must be false for @Type")); | 19623 | ir_add_error_node(ira, source_node, buf_sprintf("Type.Fn.Param.is_generic must be false for @Type")); |
| 19624 | return ira->codegen->invalid_inst_gen->value->type; | 19624 | return ira->codegen->invalid_inst_gen->value->type; |
| 19625 | } | 19625 | } |
| 19626 | if ((err = get_const_field_bool(ira, source_node, arg_value, "is_noalias", 1, &info->is_noalias))) | 19626 | if ((err = get_const_field_bool(ira, source_node, arg_value, "is_noalias", 1, &info->is_noalias))) |
| ... | @@ -19628,7 +19628,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ | ... | @@ -19628,7 +19628,7 @@ static ZigType *type_info_to_type(IrAnalyze *ira, Scope *scope, AstNode *source_ |
| 19628 | ZigType *type = get_const_field_meta_type_optional( | 19628 | ZigType *type = get_const_field_meta_type_optional( |
| 19629 | ira, source_node, arg_value, "arg_type", 2); | 19629 | ira, source_node, arg_value, "arg_type", 2); |
| 19630 | if (type == nullptr) { | 19630 | if (type == nullptr) { |
| 19631 | ir_add_error_node(ira, source_node, buf_sprintf("TypeInfo.Fn.Param.arg_type must be non-null for @Type")); | 19631 | ir_add_error_node(ira, source_node, buf_sprintf("Type.Fn.Param.arg_type must be non-null for @Type")); |
| 19632 | return ira->codegen->invalid_inst_gen->value->type; | 19632 | return ira->codegen->invalid_inst_gen->value->type; |
| 19633 | } | 19633 | } |
| 19634 | info->type = type; | 19634 | info->type = type; |
src/type.zig+5-5| ... | @@ -1527,7 +1527,7 @@ pub const Type = extern union { | ... | @@ -1527,7 +1527,7 @@ pub const Type = extern union { |
| 1527 | .prefetch_options => return writer.writeAll("std.builtin.PrefetchOptions"), | 1527 | .prefetch_options => return writer.writeAll("std.builtin.PrefetchOptions"), |
| 1528 | .export_options => return writer.writeAll("std.builtin.ExportOptions"), | 1528 | .export_options => return writer.writeAll("std.builtin.ExportOptions"), |
| 1529 | .extern_options => return writer.writeAll("std.builtin.ExternOptions"), | 1529 | .extern_options => return writer.writeAll("std.builtin.ExternOptions"), |
| 1530 | .type_info => return writer.writeAll("std.builtin.TypeInfo"), | 1530 | .type_info => return writer.writeAll("std.builtin.Type"), |
| 1531 | .function => { | 1531 | .function => { |
| 1532 | const payload = ty.castTag(.function).?.data; | 1532 | const payload = ty.castTag(.function).?.data; |
| 1533 | try writer.writeAll("fn("); | 1533 | try writer.writeAll("fn("); |
| ... | @@ -1866,7 +1866,7 @@ pub const Type = extern union { | ... | @@ -1866,7 +1866,7 @@ pub const Type = extern union { |
| 1866 | .prefetch_options => return "PrefetchOptions", | 1866 | .prefetch_options => return "PrefetchOptions", |
| 1867 | .export_options => return "ExportOptions", | 1867 | .export_options => return "ExportOptions", |
| 1868 | .extern_options => return "ExternOptions", | 1868 | .extern_options => return "ExternOptions", |
| 1869 | .type_info => return "TypeInfo", | 1869 | .type_info => return "Type", |
| 1870 | 1870 | ||
| 1871 | else => { | 1871 | else => { |
| 1872 | // TODO this is wasteful and also an incorrect implementation of `@typeName` | 1872 | // TODO this is wasteful and also an incorrect implementation of `@typeName` |
| ... | @@ -2856,7 +2856,7 @@ pub const Type = extern union { | ... | @@ -2856,7 +2856,7 @@ pub const Type = extern union { |
| 2856 | } | 2856 | } |
| 2857 | 2857 | ||
| 2858 | /// Asserts the `Type` is a pointer. | 2858 | /// Asserts the `Type` is a pointer. |
| 2859 | pub fn ptrSize(self: Type) std.builtin.TypeInfo.Pointer.Size { | 2859 | pub fn ptrSize(self: Type) std.builtin.Type.Pointer.Size { |
| 2860 | return switch (self.tag()) { | 2860 | return switch (self.tag()) { |
| 2861 | .const_slice, | 2861 | .const_slice, |
| 2862 | .mut_slice, | 2862 | .mut_slice, |
| ... | @@ -3392,7 +3392,7 @@ pub const Type = extern union { | ... | @@ -3392,7 +3392,7 @@ pub const Type = extern union { |
| 3392 | } | 3392 | } |
| 3393 | } | 3393 | } |
| 3394 | 3394 | ||
| 3395 | pub fn containerLayout(ty: Type) std.builtin.TypeInfo.ContainerLayout { | 3395 | pub fn containerLayout(ty: Type) std.builtin.Type.ContainerLayout { |
| 3396 | return switch (ty.tag()) { | 3396 | return switch (ty.tag()) { |
| 3397 | .tuple, .empty_struct_literal, .anon_struct => .Auto, | 3397 | .tuple, .empty_struct_literal, .anon_struct => .Auto, |
| 3398 | .@"struct" => ty.castTag(.@"struct").?.data.layout, | 3398 | .@"struct" => ty.castTag(.@"struct").?.data.layout, |
| ... | @@ -5165,7 +5165,7 @@ pub const Type = extern union { | ... | @@ -5165,7 +5165,7 @@ pub const Type = extern union { |
| 5165 | @"allowzero": bool = false, | 5165 | @"allowzero": bool = false, |
| 5166 | mutable: bool = true, // TODO rename this to const, not mutable | 5166 | mutable: bool = true, // TODO rename this to const, not mutable |
| 5167 | @"volatile": bool = false, | 5167 | @"volatile": bool = false, |
| 5168 | size: std.builtin.TypeInfo.Pointer.Size = .One, | 5168 | size: std.builtin.Type.Pointer.Size = .One, |
| 5169 | }; | 5169 | }; |
| 5170 | }; | 5170 | }; |
| 5171 | 5171 |
src/value.zig+1-1| ... | @@ -673,7 +673,7 @@ pub const Value = extern union { | ... | @@ -673,7 +673,7 @@ pub const Value = extern union { |
| 673 | .prefetch_options_type => return out_stream.writeAll("std.builtin.PrefetchOptions"), | 673 | .prefetch_options_type => return out_stream.writeAll("std.builtin.PrefetchOptions"), |
| 674 | .export_options_type => return out_stream.writeAll("std.builtin.ExportOptions"), | 674 | .export_options_type => return out_stream.writeAll("std.builtin.ExportOptions"), |
| 675 | .extern_options_type => return out_stream.writeAll("std.builtin.ExternOptions"), | 675 | .extern_options_type => return out_stream.writeAll("std.builtin.ExternOptions"), |
| 676 | .type_info_type => return out_stream.writeAll("std.builtin.TypeInfo"), | 676 | .type_info_type => return out_stream.writeAll("std.builtin.Type"), |
| 677 | .abi_align_default => return out_stream.writeAll("(default ABI alignment)"), | 677 | .abi_align_default => return out_stream.writeAll("(default ABI alignment)"), |
| 678 | 678 | ||
| 679 | .empty_struct_value => return out_stream.writeAll("struct {}{}"), | 679 | .empty_struct_value => return out_stream.writeAll("struct {}{}"), |
test/behavior/bugs/1421.zig+1-1| ... | @@ -2,7 +2,7 @@ const std = @import("std"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const expect = std.testing.expect; | 2 | const expect = std.testing.expect; |
| 3 | 3 | ||
| 4 | const S = struct { | 4 | const S = struct { |
| 5 | fn method() std.builtin.TypeInfo { | 5 | fn method() std.builtin.Type { |
| 6 | return @typeInfo(S); | 6 | return @typeInfo(S); |
| 7 | } | 7 | } |
| 8 | }; | 8 | }; |
test/behavior/bugs/6456.zig+2-2| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const testing = std.testing; | 2 | const testing = std.testing; |
| 3 | const StructField = std.builtin.TypeInfo.StructField; | 3 | const StructField = std.builtin.Type.StructField; |
| 4 | const Declaration = std.builtin.TypeInfo.Declaration; | 4 | const Declaration = std.builtin.Type.Declaration; |
| 5 | 5 | ||
| 6 | const text = | 6 | const text = |
| 7 | \\f1 | 7 | \\f1 |
test/behavior/tuple.zig+6-6| ... | @@ -125,23 +125,23 @@ test "tuple initializer for var" { | ... | @@ -125,23 +125,23 @@ test "tuple initializer for var" { |
| 125 | test "array-like initializer for tuple types" { | 125 | test "array-like initializer for tuple types" { |
| 126 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 126 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO |
| 127 | 127 | ||
| 128 | const T = @Type(std.builtin.TypeInfo{ | 128 | const T = @Type(.{ |
| 129 | .Struct = std.builtin.TypeInfo.Struct{ | 129 | .Struct = .{ |
| 130 | .is_tuple = true, | 130 | .is_tuple = true, |
| 131 | .layout = .Auto, | 131 | .layout = .Auto, |
| 132 | .decls = &[_]std.builtin.TypeInfo.Declaration{}, | 132 | .decls = &.{}, |
| 133 | .fields = &[_]std.builtin.TypeInfo.StructField{ | 133 | .fields = &.{ |
| 134 | .{ | 134 | .{ |
| 135 | .name = "0", | 135 | .name = "0", |
| 136 | .field_type = i32, | 136 | .field_type = i32, |
| 137 | .default_value = @as(?i32, null), | 137 | .default_value = null, |
| 138 | .is_comptime = false, | 138 | .is_comptime = false, |
| 139 | .alignment = @alignOf(i32), | 139 | .alignment = @alignOf(i32), |
| 140 | }, | 140 | }, |
| 141 | .{ | 141 | .{ |
| 142 | .name = "1", | 142 | .name = "1", |
| 143 | .field_type = u8, | 143 | .field_type = u8, |
| 144 | .default_value = @as(?i32, null), | 144 | .default_value = null, |
| 145 | .is_comptime = false, | 145 | .is_comptime = false, |
| 146 | .alignment = @alignOf(i32), | 146 | .alignment = @alignOf(i32), |
| 147 | }, | 147 | }, |
test/behavior/type.zig+52-52| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | const TypeInfo = std.builtin.TypeInfo; | 3 | const Type = std.builtin.Type; |
| 4 | const testing = std.testing; | 4 | const testing = std.testing; |
| 5 | 5 | ||
| 6 | fn testTypes(comptime types: []const type) !void { | 6 | fn testTypes(comptime types: []const type) !void { |
| ... | @@ -10,32 +10,32 @@ fn testTypes(comptime types: []const type) !void { | ... | @@ -10,32 +10,32 @@ fn testTypes(comptime types: []const type) !void { |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | test "Type.MetaType" { | 12 | test "Type.MetaType" { |
| 13 | try testing.expect(type == @Type(TypeInfo{ .Type = undefined })); | 13 | try testing.expect(type == @Type(.{ .Type = {} })); |
| 14 | try testTypes(&[_]type{type}); | 14 | try testTypes(&[_]type{type}); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | test "Type.Void" { | 17 | test "Type.Void" { |
| 18 | try testing.expect(void == @Type(TypeInfo{ .Void = undefined })); | 18 | try testing.expect(void == @Type(.{ .Void = {} })); |
| 19 | try testTypes(&[_]type{void}); | 19 | try testTypes(&[_]type{void}); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | test "Type.Bool" { | 22 | test "Type.Bool" { |
| 23 | try testing.expect(bool == @Type(TypeInfo{ .Bool = undefined })); | 23 | try testing.expect(bool == @Type(.{ .Bool = {} })); |
| 24 | try testTypes(&[_]type{bool}); | 24 | try testTypes(&[_]type{bool}); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | test "Type.NoReturn" { | 27 | test "Type.NoReturn" { |
| 28 | try testing.expect(noreturn == @Type(TypeInfo{ .NoReturn = undefined })); | 28 | try testing.expect(noreturn == @Type(.{ .NoReturn = {} })); |
| 29 | try testTypes(&[_]type{noreturn}); | 29 | try testTypes(&[_]type{noreturn}); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | test "Type.Int" { | 32 | test "Type.Int" { |
| 33 | try testing.expect(u1 == @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .unsigned, .bits = 1 } })); | 33 | try testing.expect(u1 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 1 } })); |
| 34 | try testing.expect(i1 == @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .signed, .bits = 1 } })); | 34 | try testing.expect(i1 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 1 } })); |
| 35 | try testing.expect(u8 == @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .unsigned, .bits = 8 } })); | 35 | try testing.expect(u8 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 8 } })); |
| 36 | try testing.expect(i8 == @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .signed, .bits = 8 } })); | 36 | try testing.expect(i8 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 8 } })); |
| 37 | try testing.expect(u64 == @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .unsigned, .bits = 64 } })); | 37 | try testing.expect(u64 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 64 } })); |
| 38 | try testing.expect(i64 == @Type(TypeInfo{ .Int = TypeInfo.Int{ .signedness = .signed, .bits = 64 } })); | 38 | try testing.expect(i64 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 64 } })); |
| 39 | try testTypes(&[_]type{ u8, u32, i64 }); | 39 | try testTypes(&[_]type{ u8, u32, i64 }); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| ... | @@ -104,31 +104,31 @@ test "Type.Pointer" { | ... | @@ -104,31 +104,31 @@ test "Type.Pointer" { |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | test "Type.Float" { | 106 | test "Type.Float" { |
| 107 | try testing.expect(f16 == @Type(TypeInfo{ .Float = TypeInfo.Float{ .bits = 16 } })); | 107 | try testing.expect(f16 == @Type(.{ .Float = .{ .bits = 16 } })); |
| 108 | try testing.expect(f32 == @Type(TypeInfo{ .Float = TypeInfo.Float{ .bits = 32 } })); | 108 | try testing.expect(f32 == @Type(.{ .Float = .{ .bits = 32 } })); |
| 109 | try testing.expect(f64 == @Type(TypeInfo{ .Float = TypeInfo.Float{ .bits = 64 } })); | 109 | try testing.expect(f64 == @Type(.{ .Float = .{ .bits = 64 } })); |
| 110 | try testing.expect(f80 == @Type(TypeInfo{ .Float = TypeInfo.Float{ .bits = 80 } })); | 110 | try testing.expect(f80 == @Type(.{ .Float = .{ .bits = 80 } })); |
| 111 | try testing.expect(f128 == @Type(TypeInfo{ .Float = TypeInfo.Float{ .bits = 128 } })); | 111 | try testing.expect(f128 == @Type(.{ .Float = .{ .bits = 128 } })); |
| 112 | try testTypes(&[_]type{ f16, f32, f64, f80, f128 }); | 112 | try testTypes(&[_]type{ f16, f32, f64, f80, f128 }); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | test "Type.Array" { | 115 | test "Type.Array" { |
| 116 | try testing.expect([123]u8 == @Type(TypeInfo{ | 116 | try testing.expect([123]u8 == @Type(.{ |
| 117 | .Array = TypeInfo.Array{ | 117 | .Array = .{ |
| 118 | .len = 123, | 118 | .len = 123, |
| 119 | .child = u8, | 119 | .child = u8, |
| 120 | .sentinel = null, | 120 | .sentinel = null, |
| 121 | }, | 121 | }, |
| 122 | })); | 122 | })); |
| 123 | try testing.expect([2]u32 == @Type(TypeInfo{ | 123 | try testing.expect([2]u32 == @Type(.{ |
| 124 | .Array = TypeInfo.Array{ | 124 | .Array = .{ |
| 125 | .len = 2, | 125 | .len = 2, |
| 126 | .child = u32, | 126 | .child = u32, |
| 127 | .sentinel = null, | 127 | .sentinel = null, |
| 128 | }, | 128 | }, |
| 129 | })); | 129 | })); |
| 130 | try testing.expect([2:0]u32 == @Type(TypeInfo{ | 130 | try testing.expect([2:0]u32 == @Type(.{ |
| 131 | .Array = TypeInfo.Array{ | 131 | .Array = .{ |
| 132 | .len = 2, | 132 | .len = 2, |
| 133 | .child = u32, | 133 | .child = u32, |
| 134 | .sentinel = &@as(u32, 0), | 134 | .sentinel = &@as(u32, 0), |
| ... | @@ -138,7 +138,7 @@ test "Type.Array" { | ... | @@ -138,7 +138,7 @@ test "Type.Array" { |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | test "@Type create slice with null sentinel" { | 140 | test "@Type create slice with null sentinel" { |
| 141 | const Slice = @Type(TypeInfo{ | 141 | const Slice = @Type(.{ |
| 142 | .Pointer = .{ | 142 | .Pointer = .{ |
| 143 | .size = .Slice, | 143 | .size = .Slice, |
| 144 | .is_const = true, | 144 | .is_const = true, |
| ... | @@ -153,7 +153,7 @@ test "@Type create slice with null sentinel" { | ... | @@ -153,7 +153,7 @@ test "@Type create slice with null sentinel" { |
| 153 | try testing.expect(Slice == []align(8) const *i32); | 153 | try testing.expect(Slice == []align(8) const *i32); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | test "@Type picks up the sentinel value from TypeInfo" { | 156 | test "@Type picks up the sentinel value from Type" { |
| 157 | try testTypes(&[_]type{ | 157 | try testTypes(&[_]type{ |
| 158 | [11:0]u8, [4:10]u8, | 158 | [11:0]u8, [4:10]u8, |
| 159 | [*:0]u8, [*:0]const u8, | 159 | [*:0]u8, [*:0]const u8, |
| ... | @@ -203,13 +203,13 @@ test "Type.Opaque" { | ... | @@ -203,13 +203,13 @@ test "Type.Opaque" { |
| 203 | 203 | ||
| 204 | const Opaque = @Type(.{ | 204 | const Opaque = @Type(.{ |
| 205 | .Opaque = .{ | 205 | .Opaque = .{ |
| 206 | .decls = &[_]TypeInfo.Declaration{}, | 206 | .decls = &.{}, |
| 207 | }, | 207 | }, |
| 208 | }); | 208 | }); |
| 209 | try testing.expect(Opaque != opaque {}); | 209 | try testing.expect(Opaque != opaque {}); |
| 210 | try testing.expectEqualSlices( | 210 | try testing.expectEqualSlices( |
| 211 | TypeInfo.Declaration, | 211 | Type.Declaration, |
| 212 | &[_]TypeInfo.Declaration{}, | 212 | &.{}, |
| 213 | @typeInfo(Opaque).Opaque.decls, | 213 | @typeInfo(Opaque).Opaque.decls, |
| 214 | ); | 214 | ); |
| 215 | } | 215 | } |
| ... | @@ -240,14 +240,14 @@ fn add(a: i32, b: i32) i32 { | ... | @@ -240,14 +240,14 @@ fn add(a: i32, b: i32) i32 { |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | test "Type.ErrorSet" { | 242 | test "Type.ErrorSet" { |
| 243 | try testing.expect(@Type(TypeInfo{ .ErrorSet = null }) == anyerror); | 243 | try testing.expect(@Type(.{ .ErrorSet = null }) == anyerror); |
| 244 | 244 | ||
| 245 | // error sets don't compare equal so just check if they compile | 245 | // error sets don't compare equal so just check if they compile |
| 246 | _ = @Type(@typeInfo(error{})); | 246 | _ = @Type(@typeInfo(error{})); |
| 247 | _ = @Type(@typeInfo(error{A})); | 247 | _ = @Type(@typeInfo(error{A})); |
| 248 | _ = @Type(@typeInfo(error{ A, B, C })); | 248 | _ = @Type(@typeInfo(error{ A, B, C })); |
| 249 | _ = @Type(TypeInfo{ | 249 | _ = @Type(.{ |
| 250 | .ErrorSet = &[_]TypeInfo.Error{ | 250 | .ErrorSet = &[_]Type.Error{ |
| 251 | .{ .name = "A" }, | 251 | .{ .name = "A" }, |
| 252 | .{ .name = "B" }, | 252 | .{ .name = "B" }, |
| 253 | .{ .name = "C" }, | 253 | .{ .name = "C" }, |
| ... | @@ -260,14 +260,14 @@ test "Type.Struct" { | ... | @@ -260,14 +260,14 @@ test "Type.Struct" { |
| 260 | 260 | ||
| 261 | const A = @Type(@typeInfo(struct { x: u8, y: u32 })); | 261 | const A = @Type(@typeInfo(struct { x: u8, y: u32 })); |
| 262 | const infoA = @typeInfo(A).Struct; | 262 | const infoA = @typeInfo(A).Struct; |
| 263 | try testing.expectEqual(TypeInfo.ContainerLayout.Auto, infoA.layout); | 263 | try testing.expectEqual(Type.ContainerLayout.Auto, infoA.layout); |
| 264 | try testing.expectEqualSlices(u8, "x", infoA.fields[0].name); | 264 | try testing.expectEqualSlices(u8, "x", infoA.fields[0].name); |
| 265 | try testing.expectEqual(u8, infoA.fields[0].field_type); | 265 | try testing.expectEqual(u8, infoA.fields[0].field_type); |
| 266 | try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[0].default_value); | 266 | try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[0].default_value); |
| 267 | try testing.expectEqualSlices(u8, "y", infoA.fields[1].name); | 267 | try testing.expectEqualSlices(u8, "y", infoA.fields[1].name); |
| 268 | try testing.expectEqual(u32, infoA.fields[1].field_type); | 268 | try testing.expectEqual(u32, infoA.fields[1].field_type); |
| 269 | try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[1].default_value); | 269 | try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[1].default_value); |
| 270 | try testing.expectEqualSlices(TypeInfo.Declaration, &[_]TypeInfo.Declaration{}, infoA.decls); | 270 | try testing.expectEqualSlices(Type.Declaration, &.{}, infoA.decls); |
| 271 | try testing.expectEqual(@as(bool, false), infoA.is_tuple); | 271 | try testing.expectEqual(@as(bool, false), infoA.is_tuple); |
| 272 | 272 | ||
| 273 | var a = A{ .x = 0, .y = 1 }; | 273 | var a = A{ .x = 0, .y = 1 }; |
| ... | @@ -278,7 +278,7 @@ test "Type.Struct" { | ... | @@ -278,7 +278,7 @@ test "Type.Struct" { |
| 278 | 278 | ||
| 279 | const B = @Type(@typeInfo(extern struct { x: u8, y: u32 = 5 })); | 279 | const B = @Type(@typeInfo(extern struct { x: u8, y: u32 = 5 })); |
| 280 | const infoB = @typeInfo(B).Struct; | 280 | const infoB = @typeInfo(B).Struct; |
| 281 | try testing.expectEqual(TypeInfo.ContainerLayout.Extern, infoB.layout); | 281 | try testing.expectEqual(Type.ContainerLayout.Extern, infoB.layout); |
| 282 | try testing.expectEqualSlices(u8, "x", infoB.fields[0].name); | 282 | try testing.expectEqualSlices(u8, "x", infoB.fields[0].name); |
| 283 | try testing.expectEqual(u8, infoB.fields[0].field_type); | 283 | try testing.expectEqual(u8, infoB.fields[0].field_type); |
| 284 | try testing.expectEqual(@as(?*const anyopaque, null), infoB.fields[0].default_value); | 284 | try testing.expectEqual(@as(?*const anyopaque, null), infoB.fields[0].default_value); |
| ... | @@ -290,7 +290,7 @@ test "Type.Struct" { | ... | @@ -290,7 +290,7 @@ test "Type.Struct" { |
| 290 | 290 | ||
| 291 | const C = @Type(@typeInfo(packed struct { x: u8 = 3, y: u32 = 5 })); | 291 | const C = @Type(@typeInfo(packed struct { x: u8 = 3, y: u32 = 5 })); |
| 292 | const infoC = @typeInfo(C).Struct; | 292 | const infoC = @typeInfo(C).Struct; |
| 293 | try testing.expectEqual(TypeInfo.ContainerLayout.Packed, infoC.layout); | 293 | try testing.expectEqual(Type.ContainerLayout.Packed, infoC.layout); |
| 294 | try testing.expectEqualSlices(u8, "x", infoC.fields[0].name); | 294 | try testing.expectEqualSlices(u8, "x", infoC.fields[0].name); |
| 295 | try testing.expectEqual(u8, infoC.fields[0].field_type); | 295 | try testing.expectEqual(u8, infoC.fields[0].field_type); |
| 296 | try testing.expectEqual(@as(u8, 3), @ptrCast(*const u8, infoC.fields[0].default_value.?).*); | 296 | try testing.expectEqual(@as(u8, 3), @ptrCast(*const u8, infoC.fields[0].default_value.?).*); |
| ... | @@ -308,11 +308,11 @@ test "Type.Enum" { | ... | @@ -308,11 +308,11 @@ test "Type.Enum" { |
| 308 | .Enum = .{ | 308 | .Enum = .{ |
| 309 | .layout = .Auto, | 309 | .layout = .Auto, |
| 310 | .tag_type = u8, | 310 | .tag_type = u8, |
| 311 | .fields = &[_]TypeInfo.EnumField{ | 311 | .fields = &.{ |
| 312 | .{ .name = "a", .value = 1 }, | 312 | .{ .name = "a", .value = 1 }, |
| 313 | .{ .name = "b", .value = 5 }, | 313 | .{ .name = "b", .value = 5 }, |
| 314 | }, | 314 | }, |
| 315 | .decls = &[_]TypeInfo.Declaration{}, | 315 | .decls = &.{}, |
| 316 | .is_exhaustive = true, | 316 | .is_exhaustive = true, |
| 317 | }, | 317 | }, |
| 318 | }); | 318 | }); |
| ... | @@ -323,11 +323,11 @@ test "Type.Enum" { | ... | @@ -323,11 +323,11 @@ test "Type.Enum" { |
| 323 | .Enum = .{ | 323 | .Enum = .{ |
| 324 | .layout = .Extern, | 324 | .layout = .Extern, |
| 325 | .tag_type = u32, | 325 | .tag_type = u32, |
| 326 | .fields = &[_]TypeInfo.EnumField{ | 326 | .fields = &.{ |
| 327 | .{ .name = "a", .value = 1 }, | 327 | .{ .name = "a", .value = 1 }, |
| 328 | .{ .name = "b", .value = 5 }, | 328 | .{ .name = "b", .value = 5 }, |
| 329 | }, | 329 | }, |
| 330 | .decls = &[_]TypeInfo.Declaration{}, | 330 | .decls = &.{}, |
| 331 | .is_exhaustive = false, | 331 | .is_exhaustive = false, |
| 332 | }, | 332 | }, |
| 333 | }); | 333 | }); |
| ... | @@ -344,11 +344,11 @@ test "Type.Union" { | ... | @@ -344,11 +344,11 @@ test "Type.Union" { |
| 344 | .Union = .{ | 344 | .Union = .{ |
| 345 | .layout = .Auto, | 345 | .layout = .Auto, |
| 346 | .tag_type = null, | 346 | .tag_type = null, |
| 347 | .fields = &[_]TypeInfo.UnionField{ | 347 | .fields = &.{ |
| 348 | .{ .name = "int", .field_type = i32, .alignment = @alignOf(f32) }, | 348 | .{ .name = "int", .field_type = i32, .alignment = @alignOf(f32) }, |
| 349 | .{ .name = "float", .field_type = f32, .alignment = @alignOf(f32) }, | 349 | .{ .name = "float", .field_type = f32, .alignment = @alignOf(f32) }, |
| 350 | }, | 350 | }, |
| 351 | .decls = &[_]TypeInfo.Declaration{}, | 351 | .decls = &.{}, |
| 352 | }, | 352 | }, |
| 353 | }); | 353 | }); |
| 354 | var untagged = Untagged{ .int = 1 }; | 354 | var untagged = Untagged{ .int = 1 }; |
| ... | @@ -360,11 +360,11 @@ test "Type.Union" { | ... | @@ -360,11 +360,11 @@ test "Type.Union" { |
| 360 | .Union = .{ | 360 | .Union = .{ |
| 361 | .layout = .Packed, | 361 | .layout = .Packed, |
| 362 | .tag_type = null, | 362 | .tag_type = null, |
| 363 | .fields = &[_]TypeInfo.UnionField{ | 363 | .fields = &.{ |
| 364 | .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, | 364 | .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, |
| 365 | .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, | 365 | .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, |
| 366 | }, | 366 | }, |
| 367 | .decls = &[_]TypeInfo.Declaration{}, | 367 | .decls = &.{}, |
| 368 | }, | 368 | }, |
| 369 | }); | 369 | }); |
| 370 | var packed_untagged = PackedUntagged{ .signed = -1 }; | 370 | var packed_untagged = PackedUntagged{ .signed = -1 }; |
| ... | @@ -375,11 +375,11 @@ test "Type.Union" { | ... | @@ -375,11 +375,11 @@ test "Type.Union" { |
| 375 | .Enum = .{ | 375 | .Enum = .{ |
| 376 | .layout = .Auto, | 376 | .layout = .Auto, |
| 377 | .tag_type = u1, | 377 | .tag_type = u1, |
| 378 | .fields = &[_]TypeInfo.EnumField{ | 378 | .fields = &.{ |
| 379 | .{ .name = "signed", .value = 0 }, | 379 | .{ .name = "signed", .value = 0 }, |
| 380 | .{ .name = "unsigned", .value = 1 }, | 380 | .{ .name = "unsigned", .value = 1 }, |
| 381 | }, | 381 | }, |
| 382 | .decls = &[_]TypeInfo.Declaration{}, | 382 | .decls = &.{}, |
| 383 | .is_exhaustive = true, | 383 | .is_exhaustive = true, |
| 384 | }, | 384 | }, |
| 385 | }); | 385 | }); |
| ... | @@ -387,11 +387,11 @@ test "Type.Union" { | ... | @@ -387,11 +387,11 @@ test "Type.Union" { |
| 387 | .Union = .{ | 387 | .Union = .{ |
| 388 | .layout = .Auto, | 388 | .layout = .Auto, |
| 389 | .tag_type = Tag, | 389 | .tag_type = Tag, |
| 390 | .fields = &[_]TypeInfo.UnionField{ | 390 | .fields = &.{ |
| 391 | .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, | 391 | .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, |
| 392 | .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, | 392 | .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, |
| 393 | }, | 393 | }, |
| 394 | .decls = &[_]TypeInfo.Declaration{}, | 394 | .decls = &.{}, |
| 395 | }, | 395 | }, |
| 396 | }); | 396 | }); |
| 397 | var tagged = Tagged{ .signed = -1 }; | 397 | var tagged = Tagged{ .signed = -1 }; |
| ... | @@ -407,10 +407,10 @@ test "Type.Union from Type.Enum" { | ... | @@ -407,10 +407,10 @@ test "Type.Union from Type.Enum" { |
| 407 | .Enum = .{ | 407 | .Enum = .{ |
| 408 | .layout = .Auto, | 408 | .layout = .Auto, |
| 409 | .tag_type = u0, | 409 | .tag_type = u0, |
| 410 | .fields = &[_]TypeInfo.EnumField{ | 410 | .fields = &.{ |
| 411 | .{ .name = "working_as_expected", .value = 0 }, | 411 | .{ .name = "working_as_expected", .value = 0 }, |
| 412 | }, | 412 | }, |
| 413 | .decls = &[_]TypeInfo.Declaration{}, | 413 | .decls = &.{}, |
| 414 | .is_exhaustive = true, | 414 | .is_exhaustive = true, |
| 415 | }, | 415 | }, |
| 416 | }); | 416 | }); |
| ... | @@ -418,10 +418,10 @@ test "Type.Union from Type.Enum" { | ... | @@ -418,10 +418,10 @@ test "Type.Union from Type.Enum" { |
| 418 | .Union = .{ | 418 | .Union = .{ |
| 419 | .layout = .Auto, | 419 | .layout = .Auto, |
| 420 | .tag_type = Tag, | 420 | .tag_type = Tag, |
| 421 | .fields = &[_]TypeInfo.UnionField{ | 421 | .fields = &.{ |
| 422 | .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) }, | 422 | .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) }, |
| 423 | }, | 423 | }, |
| 424 | .decls = &[_]TypeInfo.Declaration{}, | 424 | .decls = &.{}, |
| 425 | }, | 425 | }, |
| 426 | }); | 426 | }); |
| 427 | _ = T; | 427 | _ = T; |
| ... | @@ -436,10 +436,10 @@ test "Type.Union from regular enum" { | ... | @@ -436,10 +436,10 @@ test "Type.Union from regular enum" { |
| 436 | .Union = .{ | 436 | .Union = .{ |
| 437 | .layout = .Auto, | 437 | .layout = .Auto, |
| 438 | .tag_type = E, | 438 | .tag_type = E, |
| 439 | .fields = &[_]TypeInfo.UnionField{ | 439 | .fields = &.{ |
| 440 | .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) }, | 440 | .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) }, |
| 441 | }, | 441 | }, |
| 442 | .decls = &[_]TypeInfo.Declaration{}, | 442 | .decls = &.{}, |
| 443 | }, | 443 | }, |
| 444 | }); | 444 | }); |
| 445 | _ = T; | 445 | _ = T; |
test/behavior/type_info.zig+8-8| ... | @@ -2,7 +2,7 @@ const std = @import("std"); | ... | @@ -2,7 +2,7 @@ const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | const mem = std.mem; | 3 | const mem = std.mem; |
| 4 | 4 | ||
| 5 | const TypeInfo = std.builtin.TypeInfo; | 5 | const Type = std.builtin.Type; |
| 6 | const TypeId = std.builtin.TypeId; | 6 | const TypeId = std.builtin.TypeId; |
| 7 | 7 | ||
| 8 | const expect = std.testing.expect; | 8 | const expect = std.testing.expect; |
| ... | @@ -64,7 +64,7 @@ test "type info: tag type, void info" { | ... | @@ -64,7 +64,7 @@ test "type info: tag type, void info" { |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | fn testBasic() !void { | 66 | fn testBasic() !void { |
| 67 | try expect(@typeInfo(TypeInfo).Union.tag_type == TypeId); | 67 | try expect(@typeInfo(Type).Union.tag_type == TypeId); |
| 68 | const void_info = @typeInfo(void); | 68 | const void_info = @typeInfo(void); |
| 69 | try expect(void_info == TypeId.Void); | 69 | try expect(void_info == TypeId.Void); |
| 70 | try expect(void_info.Void == {}); | 70 | try expect(void_info.Void == {}); |
| ... | @@ -78,7 +78,7 @@ test "type info: pointer type info" { | ... | @@ -78,7 +78,7 @@ test "type info: pointer type info" { |
| 78 | fn testPointer() !void { | 78 | fn testPointer() !void { |
| 79 | const u32_ptr_info = @typeInfo(*u32); | 79 | const u32_ptr_info = @typeInfo(*u32); |
| 80 | try expect(u32_ptr_info == .Pointer); | 80 | try expect(u32_ptr_info == .Pointer); |
| 81 | try expect(u32_ptr_info.Pointer.size == TypeInfo.Pointer.Size.One); | 81 | try expect(u32_ptr_info.Pointer.size == .One); |
| 82 | try expect(u32_ptr_info.Pointer.is_const == false); | 82 | try expect(u32_ptr_info.Pointer.is_const == false); |
| 83 | try expect(u32_ptr_info.Pointer.is_volatile == false); | 83 | try expect(u32_ptr_info.Pointer.is_volatile == false); |
| 84 | try expect(u32_ptr_info.Pointer.alignment == @alignOf(u32)); | 84 | try expect(u32_ptr_info.Pointer.alignment == @alignOf(u32)); |
| ... | @@ -94,7 +94,7 @@ test "type info: unknown length pointer type info" { | ... | @@ -94,7 +94,7 @@ test "type info: unknown length pointer type info" { |
| 94 | fn testUnknownLenPtr() !void { | 94 | fn testUnknownLenPtr() !void { |
| 95 | const u32_ptr_info = @typeInfo([*]const volatile f64); | 95 | const u32_ptr_info = @typeInfo([*]const volatile f64); |
| 96 | try expect(u32_ptr_info == .Pointer); | 96 | try expect(u32_ptr_info == .Pointer); |
| 97 | try expect(u32_ptr_info.Pointer.size == TypeInfo.Pointer.Size.Many); | 97 | try expect(u32_ptr_info.Pointer.size == .Many); |
| 98 | try expect(u32_ptr_info.Pointer.is_const == true); | 98 | try expect(u32_ptr_info.Pointer.is_const == true); |
| 99 | try expect(u32_ptr_info.Pointer.is_volatile == true); | 99 | try expect(u32_ptr_info.Pointer.is_volatile == true); |
| 100 | try expect(u32_ptr_info.Pointer.sentinel == null); | 100 | try expect(u32_ptr_info.Pointer.sentinel == null); |
| ... | @@ -110,7 +110,7 @@ test "type info: null terminated pointer type info" { | ... | @@ -110,7 +110,7 @@ test "type info: null terminated pointer type info" { |
| 110 | fn testNullTerminatedPtr() !void { | 110 | fn testNullTerminatedPtr() !void { |
| 111 | const ptr_info = @typeInfo([*:0]u8); | 111 | const ptr_info = @typeInfo([*:0]u8); |
| 112 | try expect(ptr_info == .Pointer); | 112 | try expect(ptr_info == .Pointer); |
| 113 | try expect(ptr_info.Pointer.size == TypeInfo.Pointer.Size.Many); | 113 | try expect(ptr_info.Pointer.size == .Many); |
| 114 | try expect(ptr_info.Pointer.is_const == false); | 114 | try expect(ptr_info.Pointer.is_const == false); |
| 115 | try expect(ptr_info.Pointer.is_volatile == false); | 115 | try expect(ptr_info.Pointer.is_volatile == false); |
| 116 | try expect(@ptrCast(*const u8, ptr_info.Pointer.sentinel.?).* == 0); | 116 | try expect(@ptrCast(*const u8, ptr_info.Pointer.sentinel.?).* == 0); |
| ... | @@ -254,7 +254,7 @@ test "type info: union info" { | ... | @@ -254,7 +254,7 @@ test "type info: union info" { |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | fn testUnion() !void { | 256 | fn testUnion() !void { |
| 257 | const typeinfo_info = @typeInfo(TypeInfo); | 257 | const typeinfo_info = @typeInfo(Type); |
| 258 | try expect(typeinfo_info == .Union); | 258 | try expect(typeinfo_info == .Union); |
| 259 | try expect(typeinfo_info.Union.layout == .Auto); | 259 | try expect(typeinfo_info.Union.layout == .Auto); |
| 260 | try expect(typeinfo_info.Union.tag_type.? == TypeId); | 260 | try expect(typeinfo_info.Union.tag_type.? == TypeId); |
| ... | @@ -437,12 +437,12 @@ test "type info: pass to function" { | ... | @@ -437,12 +437,12 @@ test "type info: pass to function" { |
| 437 | _ = comptime passTypeInfo(@typeInfo(void)); | 437 | _ = comptime passTypeInfo(@typeInfo(void)); |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | fn passTypeInfo(comptime info: TypeInfo) type { | 440 | fn passTypeInfo(comptime info: Type) type { |
| 441 | _ = info; | 441 | _ = info; |
| 442 | return void; | 442 | return void; |
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | test "type info: TypeId -> TypeInfo impl cast" { | 445 | test "type info: TypeId -> Type impl cast" { |
| 446 | _ = passTypeInfo(TypeId.Void); | 446 | _ = passTypeInfo(TypeId.Void); |
| 447 | _ = comptime passTypeInfo(TypeId.Void); | 447 | _ = comptime passTypeInfo(TypeId.Void); |
| 448 | } | 448 | } |
test/compile_errors.zig+44-51| ... | @@ -95,12 +95,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -95,12 +95,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 95 | }); | 95 | }); |
| 96 | 96 | ||
| 97 | ctx.objErrStage1("@Type() union payload is undefined", | 97 | ctx.objErrStage1("@Type() union payload is undefined", |
| 98 | \\const Foo = @Type(@import("std").builtin.TypeInfo{ | 98 | \\const Foo = @Type(.{ |
| 99 | \\ .Struct = undefined, | 99 | \\ .Struct = undefined, |
| 100 | \\}); | 100 | \\}); |
| 101 | \\comptime { _ = Foo; } | 101 | \\comptime { _ = Foo; } |
| 102 | , &[_][]const u8{ | 102 | , &[_][]const u8{ |
| 103 | "tmp.zig:1:50: error: use of undefined value here causes undefined behavior", | 103 | "tmp.zig:1:20: error: use of undefined value here causes undefined behavior", |
| 104 | }); | 104 | }); |
| 105 | 105 | ||
| 106 | ctx.objErrStage1("wrong initializer for union payload of type 'type'", | 106 | ctx.objErrStage1("wrong initializer for union payload of type 'type'", |
| ... | @@ -258,16 +258,16 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -258,16 +258,16 @@ pub fn addCases(ctx: *TestContext) !void { |
| 258 | "tmp.zig:8:12: note: called from here", | 258 | "tmp.zig:8:12: note: called from here", |
| 259 | }); | 259 | }); |
| 260 | 260 | ||
| 261 | ctx.objErrStage1("@Type with TypeInfo.Int", | 261 | ctx.objErrStage1("@Type with Type.Int", |
| 262 | \\const builtin = @import("std").builtin; | 262 | \\const builtin = @import("std").builtin; |
| 263 | \\export fn entry() void { | 263 | \\export fn entry() void { |
| 264 | \\ _ = @Type(builtin.TypeInfo.Int { | 264 | \\ _ = @Type(builtin.Type.Int{ |
| 265 | \\ .signedness = .signed, | 265 | \\ .signedness = .signed, |
| 266 | \\ .bits = 8, | 266 | \\ .bits = 8, |
| 267 | \\ }); | 267 | \\ }); |
| 268 | \\} | 268 | \\} |
| 269 | , &[_][]const u8{ | 269 | , &[_][]const u8{ |
| 270 | "tmp.zig:3:36: error: expected type 'std.builtin.TypeInfo', found 'std.builtin.Int'", | 270 | "tmp.zig:3:31: error: expected type 'std.builtin.Type', found 'std.builtin.Int'", |
| 271 | }); | 271 | }); |
| 272 | 272 | ||
| 273 | ctx.objErrStage1("indexing a undefined slice at comptime", | 273 | ctx.objErrStage1("indexing a undefined slice at comptime", |
| ... | @@ -293,13 +293,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -293,13 +293,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 293 | }); | 293 | }); |
| 294 | 294 | ||
| 295 | ctx.objErrStage1("@Type for exhaustive enum with undefined tag type", | 295 | ctx.objErrStage1("@Type for exhaustive enum with undefined tag type", |
| 296 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 297 | \\const Tag = @Type(.{ | 296 | \\const Tag = @Type(.{ |
| 298 | \\ .Enum = .{ | 297 | \\ .Enum = .{ |
| 299 | \\ .layout = .Auto, | 298 | \\ .layout = .Auto, |
| 300 | \\ .tag_type = undefined, | 299 | \\ .tag_type = undefined, |
| 301 | \\ .fields = &[_]TypeInfo.EnumField{}, | 300 | \\ .fields = &.{}, |
| 302 | \\ .decls = &[_]TypeInfo.Declaration{}, | 301 | \\ .decls = &.{}, |
| 303 | \\ .is_exhaustive = false, | 302 | \\ .is_exhaustive = false, |
| 304 | \\ }, | 303 | \\ }, |
| 305 | \\}); | 304 | \\}); |
| ... | @@ -307,7 +306,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -307,7 +306,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 307 | \\ _ = @intToEnum(Tag, 0); | 306 | \\ _ = @intToEnum(Tag, 0); |
| 308 | \\} | 307 | \\} |
| 309 | , &[_][]const u8{ | 308 | , &[_][]const u8{ |
| 310 | "tmp.zig:2:20: error: use of undefined value here causes undefined behavior", | 309 | "tmp.zig:1:20: error: use of undefined value here causes undefined behavior", |
| 311 | }); | 310 | }); |
| 312 | 311 | ||
| 313 | ctx.objErrStage1("extern struct with non-extern-compatible integer tag type", | 312 | ctx.objErrStage1("extern struct with non-extern-compatible integer tag type", |
| ... | @@ -324,13 +323,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -324,13 +323,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 324 | }); | 323 | }); |
| 325 | 324 | ||
| 326 | ctx.objErrStage1("@Type for exhaustive enum with non-integer tag type", | 325 | ctx.objErrStage1("@Type for exhaustive enum with non-integer tag type", |
| 327 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 328 | \\const Tag = @Type(.{ | 326 | \\const Tag = @Type(.{ |
| 329 | \\ .Enum = .{ | 327 | \\ .Enum = .{ |
| 330 | \\ .layout = .Auto, | 328 | \\ .layout = .Auto, |
| 331 | \\ .tag_type = bool, | 329 | \\ .tag_type = bool, |
| 332 | \\ .fields = &[_]TypeInfo.EnumField{}, | 330 | \\ .fields = &.{}, |
| 333 | \\ .decls = &[_]TypeInfo.Declaration{}, | 331 | \\ .decls = &.{}, |
| 334 | \\ .is_exhaustive = false, | 332 | \\ .is_exhaustive = false, |
| 335 | \\ }, | 333 | \\ }, |
| 336 | \\}); | 334 | \\}); |
| ... | @@ -338,7 +336,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -338,7 +336,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 338 | \\ _ = @intToEnum(Tag, 0); | 336 | \\ _ = @intToEnum(Tag, 0); |
| 339 | \\} | 337 | \\} |
| 340 | , &[_][]const u8{ | 338 | , &[_][]const u8{ |
| 341 | "tmp.zig:2:20: error: TypeInfo.Enum.tag_type must be an integer type, not 'bool'", | 339 | "tmp.zig:1:20: error: Type.Enum.tag_type must be an integer type, not 'bool'", |
| 342 | }); | 340 | }); |
| 343 | 341 | ||
| 344 | ctx.objErrStage1("extern struct with extern-compatible but inferred integer tag type", | 342 | ctx.objErrStage1("extern struct with extern-compatible but inferred integer tag type", |
| ... | @@ -384,17 +382,16 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -384,17 +382,16 @@ pub fn addCases(ctx: *TestContext) !void { |
| 384 | }); | 382 | }); |
| 385 | 383 | ||
| 386 | ctx.objErrStage1("@Type for tagged union with extra enum field", | 384 | ctx.objErrStage1("@Type for tagged union with extra enum field", |
| 387 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 388 | \\const Tag = @Type(.{ | 385 | \\const Tag = @Type(.{ |
| 389 | \\ .Enum = .{ | 386 | \\ .Enum = .{ |
| 390 | \\ .layout = .Auto, | 387 | \\ .layout = .Auto, |
| 391 | \\ .tag_type = u2, | 388 | \\ .tag_type = u2, |
| 392 | \\ .fields = &[_]TypeInfo.EnumField{ | 389 | \\ .fields = &.{ |
| 393 | \\ .{ .name = "signed", .value = 0 }, | 390 | \\ .{ .name = "signed", .value = 0 }, |
| 394 | \\ .{ .name = "unsigned", .value = 1 }, | 391 | \\ .{ .name = "unsigned", .value = 1 }, |
| 395 | \\ .{ .name = "arst", .value = 2 }, | 392 | \\ .{ .name = "arst", .value = 2 }, |
| 396 | \\ }, | 393 | \\ }, |
| 397 | \\ .decls = &[_]TypeInfo.Declaration{}, | 394 | \\ .decls = &.{}, |
| 398 | \\ .is_exhaustive = true, | 395 | \\ .is_exhaustive = true, |
| 399 | \\ }, | 396 | \\ }, |
| 400 | \\}); | 397 | \\}); |
| ... | @@ -402,11 +399,11 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -402,11 +399,11 @@ pub fn addCases(ctx: *TestContext) !void { |
| 402 | \\ .Union = .{ | 399 | \\ .Union = .{ |
| 403 | \\ .layout = .Auto, | 400 | \\ .layout = .Auto, |
| 404 | \\ .tag_type = Tag, | 401 | \\ .tag_type = Tag, |
| 405 | \\ .fields = &[_]TypeInfo.UnionField{ | 402 | \\ .fields = &.{ |
| 406 | \\ .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, | 403 | \\ .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, |
| 407 | \\ .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, | 404 | \\ .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, |
| 408 | \\ }, | 405 | \\ }, |
| 409 | \\ .decls = &[_]TypeInfo.Declaration{}, | 406 | \\ .decls = &.{}, |
| 410 | \\ }, | 407 | \\ }, |
| 411 | \\}); | 408 | \\}); |
| 412 | \\export fn entry() void { | 409 | \\export fn entry() void { |
| ... | @@ -414,7 +411,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -414,7 +411,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 414 | \\ tagged = .{ .unsigned = 1 }; | 411 | \\ tagged = .{ .unsigned = 1 }; |
| 415 | \\} | 412 | \\} |
| 416 | , &[_][]const u8{ | 413 | , &[_][]const u8{ |
| 417 | "tmp.zig:15:23: error: enum field missing: 'arst'", | 414 | "tmp.zig:14:23: error: enum field missing: 'arst'", |
| 418 | }); | 415 | }); |
| 419 | 416 | ||
| 420 | ctx.objErrStage1("field access of opaque type", | 417 | ctx.objErrStage1("field access of opaque type", |
| ... | @@ -450,12 +447,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -450,12 +447,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 450 | \\ .is_generic = true, | 447 | \\ .is_generic = true, |
| 451 | \\ .is_var_args = false, | 448 | \\ .is_var_args = false, |
| 452 | \\ .return_type = u0, | 449 | \\ .return_type = u0, |
| 453 | \\ .args = &[_]@import("std").builtin.TypeInfo.Fn.Param{}, | 450 | \\ .args = &.{}, |
| 454 | \\ }, | 451 | \\ }, |
| 455 | \\}); | 452 | \\}); |
| 456 | \\comptime { _ = Foo; } | 453 | \\comptime { _ = Foo; } |
| 457 | , &[_][]const u8{ | 454 | , &[_][]const u8{ |
| 458 | "tmp.zig:1:20: error: TypeInfo.Fn.is_generic must be false for @Type", | 455 | "tmp.zig:1:20: error: Type.Fn.is_generic must be false for @Type", |
| 459 | }); | 456 | }); |
| 460 | 457 | ||
| 461 | ctx.objErrStage1("@Type(.Fn) with is_var_args = true and non-C callconv", | 458 | ctx.objErrStage1("@Type(.Fn) with is_var_args = true and non-C callconv", |
| ... | @@ -466,7 +463,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -466,7 +463,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 466 | \\ .is_generic = false, | 463 | \\ .is_generic = false, |
| 467 | \\ .is_var_args = true, | 464 | \\ .is_var_args = true, |
| 468 | \\ .return_type = u0, | 465 | \\ .return_type = u0, |
| 469 | \\ .args = &[_]@import("std").builtin.TypeInfo.Fn.Param{}, | 466 | \\ .args = &.{}, |
| 470 | \\ }, | 467 | \\ }, |
| 471 | \\}); | 468 | \\}); |
| 472 | \\comptime { _ = Foo; } | 469 | \\comptime { _ = Foo; } |
| ... | @@ -482,31 +479,30 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -482,31 +479,30 @@ pub fn addCases(ctx: *TestContext) !void { |
| 482 | \\ .is_generic = false, | 479 | \\ .is_generic = false, |
| 483 | \\ .is_var_args = false, | 480 | \\ .is_var_args = false, |
| 484 | \\ .return_type = null, | 481 | \\ .return_type = null, |
| 485 | \\ .args = &[_]@import("std").builtin.TypeInfo.Fn.Param{}, | 482 | \\ .args = &.{}, |
| 486 | \\ }, | 483 | \\ }, |
| 487 | \\}); | 484 | \\}); |
| 488 | \\comptime { _ = Foo; } | 485 | \\comptime { _ = Foo; } |
| 489 | , &[_][]const u8{ | 486 | , &[_][]const u8{ |
| 490 | "tmp.zig:1:20: error: TypeInfo.Fn.return_type must be non-null for @Type", | 487 | "tmp.zig:1:20: error: Type.Fn.return_type must be non-null for @Type", |
| 491 | }); | 488 | }); |
| 492 | 489 | ||
| 493 | ctx.objErrStage1("@Type for union with opaque field", | 490 | ctx.objErrStage1("@Type for union with opaque field", |
| 494 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 495 | \\const Untagged = @Type(.{ | 491 | \\const Untagged = @Type(.{ |
| 496 | \\ .Union = .{ | 492 | \\ .Union = .{ |
| 497 | \\ .layout = .Auto, | 493 | \\ .layout = .Auto, |
| 498 | \\ .tag_type = null, | 494 | \\ .tag_type = null, |
| 499 | \\ .fields = &[_]TypeInfo.UnionField{ | 495 | \\ .fields = &.{ |
| 500 | \\ .{ .name = "foo", .field_type = opaque {}, .alignment = 1 }, | 496 | \\ .{ .name = "foo", .field_type = opaque {}, .alignment = 1 }, |
| 501 | \\ }, | 497 | \\ }, |
| 502 | \\ .decls = &[_]TypeInfo.Declaration{}, | 498 | \\ .decls = &.{}, |
| 503 | \\ }, | 499 | \\ }, |
| 504 | \\}); | 500 | \\}); |
| 505 | \\export fn entry() void { | 501 | \\export fn entry() void { |
| 506 | \\ _ = Untagged{}; | 502 | \\ _ = Untagged{}; |
| 507 | \\} | 503 | \\} |
| 508 | , &[_][]const u8{ | 504 | , &[_][]const u8{ |
| 509 | "tmp.zig:2:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions", | 505 | "tmp.zig:1:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions", |
| 510 | }); | 506 | }); |
| 511 | 507 | ||
| 512 | ctx.objErrStage1("slice sentinel mismatch", | 508 | ctx.objErrStage1("slice sentinel mismatch", |
| ... | @@ -528,30 +524,28 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -528,30 +524,28 @@ pub fn addCases(ctx: *TestContext) !void { |
| 528 | }); | 524 | }); |
| 529 | 525 | ||
| 530 | ctx.objErrStage1("@Type for union with zero fields", | 526 | ctx.objErrStage1("@Type for union with zero fields", |
| 531 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 532 | \\const Untagged = @Type(.{ | 527 | \\const Untagged = @Type(.{ |
| 533 | \\ .Union = .{ | 528 | \\ .Union = .{ |
| 534 | \\ .layout = .Auto, | 529 | \\ .layout = .Auto, |
| 535 | \\ .tag_type = null, | 530 | \\ .tag_type = null, |
| 536 | \\ .fields = &[_]TypeInfo.UnionField{}, | 531 | \\ .fields = &.{}, |
| 537 | \\ .decls = &[_]TypeInfo.Declaration{}, | 532 | \\ .decls = &.{}, |
| 538 | \\ }, | 533 | \\ }, |
| 539 | \\}); | 534 | \\}); |
| 540 | \\export fn entry() void { | 535 | \\export fn entry() void { |
| 541 | \\ _ = Untagged{}; | 536 | \\ _ = Untagged{}; |
| 542 | \\} | 537 | \\} |
| 543 | , &[_][]const u8{ | 538 | , &[_][]const u8{ |
| 544 | "tmp.zig:2:25: error: unions must have 1 or more fields", | 539 | "tmp.zig:1:25: error: unions must have 1 or more fields", |
| 545 | }); | 540 | }); |
| 546 | 541 | ||
| 547 | ctx.objErrStage1("@Type for exhaustive enum with zero fields", | 542 | ctx.objErrStage1("@Type for exhaustive enum with zero fields", |
| 548 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 549 | \\const Tag = @Type(.{ | 543 | \\const Tag = @Type(.{ |
| 550 | \\ .Enum = .{ | 544 | \\ .Enum = .{ |
| 551 | \\ .layout = .Auto, | 545 | \\ .layout = .Auto, |
| 552 | \\ .tag_type = u1, | 546 | \\ .tag_type = u1, |
| 553 | \\ .fields = &[_]TypeInfo.EnumField{}, | 547 | \\ .fields = &.{}, |
| 554 | \\ .decls = &[_]TypeInfo.Declaration{}, | 548 | \\ .decls = &.{}, |
| 555 | \\ .is_exhaustive = true, | 549 | \\ .is_exhaustive = true, |
| 556 | \\ }, | 550 | \\ }, |
| 557 | \\}); | 551 | \\}); |
| ... | @@ -559,20 +553,19 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -559,20 +553,19 @@ pub fn addCases(ctx: *TestContext) !void { |
| 559 | \\ _ = @intToEnum(Tag, 0); | 553 | \\ _ = @intToEnum(Tag, 0); |
| 560 | \\} | 554 | \\} |
| 561 | , &[_][]const u8{ | 555 | , &[_][]const u8{ |
| 562 | "tmp.zig:2:20: error: enums must have 1 or more fields", | 556 | "tmp.zig:1:20: error: enums must have 1 or more fields", |
| 563 | }); | 557 | }); |
| 564 | 558 | ||
| 565 | ctx.objErrStage1("@Type for tagged union with extra union field", | 559 | ctx.objErrStage1("@Type for tagged union with extra union field", |
| 566 | \\const TypeInfo = @import("std").builtin.TypeInfo; | ||
| 567 | \\const Tag = @Type(.{ | 560 | \\const Tag = @Type(.{ |
| 568 | \\ .Enum = .{ | 561 | \\ .Enum = .{ |
| 569 | \\ .layout = .Auto, | 562 | \\ .layout = .Auto, |
| 570 | \\ .tag_type = u1, | 563 | \\ .tag_type = u1, |
| 571 | \\ .fields = &[_]TypeInfo.EnumField{ | 564 | \\ .fields = &.{ |
| 572 | \\ .{ .name = "signed", .value = 0 }, | 565 | \\ .{ .name = "signed", .value = 0 }, |
| 573 | \\ .{ .name = "unsigned", .value = 1 }, | 566 | \\ .{ .name = "unsigned", .value = 1 }, |
| 574 | \\ }, | 567 | \\ }, |
| 575 | \\ .decls = &[_]TypeInfo.Declaration{}, | 568 | \\ .decls = &.{}, |
| 576 | \\ .is_exhaustive = true, | 569 | \\ .is_exhaustive = true, |
| 577 | \\ }, | 570 | \\ }, |
| 578 | \\}); | 571 | \\}); |
| ... | @@ -580,12 +573,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -580,12 +573,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 580 | \\ .Union = .{ | 573 | \\ .Union = .{ |
| 581 | \\ .layout = .Auto, | 574 | \\ .layout = .Auto, |
| 582 | \\ .tag_type = Tag, | 575 | \\ .tag_type = Tag, |
| 583 | \\ .fields = &[_]TypeInfo.UnionField{ | 576 | \\ .fields = &.{ |
| 584 | \\ .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, | 577 | \\ .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, |
| 585 | \\ .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, | 578 | \\ .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, |
| 586 | \\ .{ .name = "arst", .field_type = f32, .alignment = @alignOf(f32) }, | 579 | \\ .{ .name = "arst", .field_type = f32, .alignment = @alignOf(f32) }, |
| 587 | \\ }, | 580 | \\ }, |
| 588 | \\ .decls = &[_]TypeInfo.Declaration{}, | 581 | \\ .decls = &.{}, |
| 589 | \\ }, | 582 | \\ }, |
| 590 | \\}); | 583 | \\}); |
| 591 | \\export fn entry() void { | 584 | \\export fn entry() void { |
| ... | @@ -593,8 +586,8 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -593,8 +586,8 @@ pub fn addCases(ctx: *TestContext) !void { |
| 593 | \\ tagged = .{ .unsigned = 1 }; | 586 | \\ tagged = .{ .unsigned = 1 }; |
| 594 | \\} | 587 | \\} |
| 595 | , &[_][]const u8{ | 588 | , &[_][]const u8{ |
| 596 | "tmp.zig:14:23: error: enum field not found: 'arst'", | 589 | "tmp.zig:13:23: error: enum field not found: 'arst'", |
| 597 | "tmp.zig:2:20: note: enum declared here", | 590 | "tmp.zig:1:20: note: enum declared here", |
| 598 | }); | 591 | }); |
| 599 | 592 | ||
| 600 | ctx.objErrStage1("@Type with undefined", | 593 | ctx.objErrStage1("@Type with undefined", |
| ... | @@ -621,7 +614,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -621,7 +614,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 621 | \\ _ = @Type(@typeInfo(struct { const foo = 1; })); | 614 | \\ _ = @Type(@typeInfo(struct { const foo = 1; })); |
| 622 | \\} | 615 | \\} |
| 623 | , &[_][]const u8{ | 616 | , &[_][]const u8{ |
| 624 | "tmp.zig:2:15: error: TypeInfo.Struct.decls must be empty for @Type", | 617 | "tmp.zig:2:15: error: Type.Struct.decls must be empty for @Type", |
| 625 | }); | 618 | }); |
| 626 | 619 | ||
| 627 | ctx.objErrStage1("enum with declarations unavailable for @Type", | 620 | ctx.objErrStage1("enum with declarations unavailable for @Type", |
| ... | @@ -629,7 +622,7 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -629,7 +622,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 629 | \\ _ = @Type(@typeInfo(enum { foo, const bar = 1; })); | 622 | \\ _ = @Type(@typeInfo(enum { foo, const bar = 1; })); |
| 630 | \\} | 623 | \\} |
| 631 | , &[_][]const u8{ | 624 | , &[_][]const u8{ |
| 632 | "tmp.zig:2:15: error: TypeInfo.Enum.decls must be empty for @Type", | 625 | "tmp.zig:2:15: error: Type.Enum.decls must be empty for @Type", |
| 633 | }); | 626 | }); |
| 634 | 627 | ||
| 635 | ctx.testErrStage1("reject extern variables with initializers", | 628 | ctx.testErrStage1("reject extern variables with initializers", |
| ... | @@ -2081,10 +2074,10 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -2081,10 +2074,10 @@ pub fn addCases(ctx: *TestContext) !void { |
| 2081 | ctx.objErrStage1("attempt to create 17 bit float type", | 2074 | ctx.objErrStage1("attempt to create 17 bit float type", |
| 2082 | \\const builtin = @import("std").builtin; | 2075 | \\const builtin = @import("std").builtin; |
| 2083 | \\comptime { | 2076 | \\comptime { |
| 2084 | \\ _ = @Type(builtin.TypeInfo { .Float = builtin.TypeInfo.Float { .bits = 17 } }); | 2077 | \\ _ = @Type(.{ .Float = .{ .bits = 17 } }); |
| 2085 | \\} | 2078 | \\} |
| 2086 | , &[_][]const u8{ | 2079 | , &[_][]const u8{ |
| 2087 | "tmp.zig:3:32: error: 17-bit float unsupported", | 2080 | "tmp.zig:3:16: error: 17-bit float unsupported", |
| 2088 | }); | 2081 | }); |
| 2089 | 2082 | ||
| 2090 | ctx.objErrStage1("wrong type for @Type", | 2083 | ctx.objErrStage1("wrong type for @Type", |
| ... | @@ -2092,12 +2085,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -2092,12 +2085,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 2092 | \\ _ = @Type(0); | 2085 | \\ _ = @Type(0); |
| 2093 | \\} | 2086 | \\} |
| 2094 | , &[_][]const u8{ | 2087 | , &[_][]const u8{ |
| 2095 | "tmp.zig:2:15: error: expected type 'std.builtin.TypeInfo', found 'comptime_int'", | 2088 | "tmp.zig:2:15: error: expected type 'std.builtin.Type', found 'comptime_int'", |
| 2096 | }); | 2089 | }); |
| 2097 | 2090 | ||
| 2098 | ctx.objErrStage1("@Type with non-constant expression", | 2091 | ctx.objErrStage1("@Type with non-constant expression", |
| 2099 | \\const builtin = @import("std").builtin; | 2092 | \\const builtin = @import("std").builtin; |
| 2100 | \\var globalTypeInfo : builtin.TypeInfo = undefined; | 2093 | \\var globalTypeInfo : builtin.Type = undefined; |
| 2101 | \\export fn entry() void { | 2094 | \\export fn entry() void { |
| 2102 | \\ _ = @Type(globalTypeInfo); | 2095 | \\ _ = @Type(globalTypeInfo); |
| 2103 | \\} | 2096 | \\} |
| ... | @@ -8156,12 +8149,12 @@ pub fn addCases(ctx: *TestContext) !void { | ... | @@ -8156,12 +8149,12 @@ pub fn addCases(ctx: *TestContext) !void { |
| 8156 | ctx.testErrStage1("nested vectors", | 8149 | ctx.testErrStage1("nested vectors", |
| 8157 | \\export fn entry() void { | 8150 | \\export fn entry() void { |
| 8158 | \\ const V1 = @import("std").meta.Vector(4, u8); | 8151 | \\ const V1 = @import("std").meta.Vector(4, u8); |
| 8159 | \\ const V2 = @Type(@import("std").builtin.TypeInfo{ .Vector = .{ .len = 4, .child = V1 } }); | 8152 | \\ const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } }); |
| 8160 | \\ var v: V2 = undefined; | 8153 | \\ var v: V2 = undefined; |
| 8161 | \\ _ = v; | 8154 | \\ _ = v; |
| 8162 | \\} | 8155 | \\} |
| 8163 | , &[_][]const u8{ | 8156 | , &[_][]const u8{ |
| 8164 | "tmp.zig:3:53: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid", | 8157 | "tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid", |
| 8165 | }); | 8158 | }); |
| 8166 | 8159 | ||
| 8167 | ctx.testErrStage1("bad @splat type", | 8160 | ctx.testErrStage1("bad @splat type", |