| author | |
| committer | |
| log | 20d3fd901eb6a7ddc1340107ae00e0f2014552e3 |
| tree | ed161bf6a59c4eb4304f5a422e36de7fbd131042 |
| parent | 90477e5c10c9c263a3c0038e1ae7b814d2c5397e |
It's the type of a parameter, not an argument, but the prefix is redundant either way.12 files changed, 28 insertions(+), 28 deletions(-)
doc/langref.html.in+1-1| ... | ... | @@ -5242,7 +5242,7 @@ const math = std.math; |
| 5242 | 5242 | const testing = std.testing; |
| 5243 | 5243 | |
| 5244 | 5244 | test "fn reflection" { |
| 5245 | try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.args[0].arg_type.? == bool); | |
| 5245 | try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.args[0].type.? == bool); | |
| 5246 | 5246 | try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir); |
| 5247 | 5247 | |
| 5248 | 5248 | try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic); |
lib/std/builtin.zig+1-1| ... | ... | @@ -374,7 +374,7 @@ pub const Type = union(enum) { |
| 374 | 374 | pub const Param = struct { |
| 375 | 375 | is_generic: bool, |
| 376 | 376 | is_noalias: bool, |
| 377 | arg_type: ?type, | |
| 377 | type: ?type, | |
| 378 | 378 | }; |
| 379 | 379 | }; |
| 380 | 380 |
lib/std/fmt.zig+1-1| ... | ... | @@ -1724,7 +1724,7 @@ pub const ParseIntError = error{ |
| 1724 | 1724 | /// ) !void; |
| 1725 | 1725 | /// |
| 1726 | 1726 | pub fn Formatter(comptime format_fn: anytype) type { |
| 1727 | const Data = @typeInfo(@TypeOf(format_fn)).Fn.args[0].arg_type.?; | |
| 1727 | const Data = @typeInfo(@TypeOf(format_fn)).Fn.args[0].type.?; | |
| 1728 | 1728 | return struct { |
| 1729 | 1729 | data: Data, |
| 1730 | 1730 | pub fn format( |
lib/std/hash_map.zig+8-8| ... | ... | @@ -190,7 +190,7 @@ pub fn verifyContext( |
| 190 | 190 | errors = errors ++ lazy.err_invalid_hash_signature; |
| 191 | 191 | } else { |
| 192 | 192 | var emitted_signature = false; |
| 193 | if (func.args[0].arg_type) |Self| { | |
| 193 | if (func.args[0].type) |Self| { | |
| 194 | 194 | if (Self == Context) { |
| 195 | 195 | // pass, this is always fine. |
| 196 | 196 | } else if (Self == *const Context) { |
| ... | ... | @@ -231,12 +231,12 @@ pub fn verifyContext( |
| 231 | 231 | errors = errors ++ ", but is " ++ @typeName(Self); |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | if (func.args[1].arg_type != null and func.args[1].arg_type.? != PseudoKey) { | |
| 234 | if (func.args[1].type != null and func.args[1].type.? != PseudoKey) { | |
| 235 | 235 | if (!emitted_signature) { |
| 236 | 236 | errors = errors ++ lazy.err_invalid_hash_signature; |
| 237 | 237 | emitted_signature = true; |
| 238 | 238 | } |
| 239 | errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?); | |
| 239 | errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].type.?); | |
| 240 | 240 | } |
| 241 | 241 | if (func.return_type != null and func.return_type.? != Hash) { |
| 242 | 242 | if (!emitted_signature) { |
| ... | ... | @@ -267,7 +267,7 @@ pub fn verifyContext( |
| 267 | 267 | errors = errors ++ lazy.err_invalid_eql_signature; |
| 268 | 268 | } else { |
| 269 | 269 | var emitted_signature = false; |
| 270 | if (func.args[0].arg_type) |Self| { | |
| 270 | if (func.args[0].type) |Self| { | |
| 271 | 271 | if (Self == Context) { |
| 272 | 272 | // pass, this is always fine. |
| 273 | 273 | } else if (Self == *const Context) { |
| ... | ... | @@ -308,19 +308,19 @@ pub fn verifyContext( |
| 308 | 308 | errors = errors ++ ", but is " ++ @typeName(Self); |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | if (func.args[1].arg_type.? != PseudoKey) { | |
| 311 | if (func.args[1].type.? != PseudoKey) { | |
| 312 | 312 | if (!emitted_signature) { |
| 313 | 313 | errors = errors ++ lazy.err_invalid_eql_signature; |
| 314 | 314 | emitted_signature = true; |
| 315 | 315 | } |
| 316 | errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?); | |
| 316 | errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].type.?); | |
| 317 | 317 | } |
| 318 | if (func.args[2].arg_type.? != Key) { | |
| 318 | if (func.args[2].type.? != Key) { | |
| 319 | 319 | if (!emitted_signature) { |
| 320 | 320 | errors = errors ++ lazy.err_invalid_eql_signature; |
| 321 | 321 | emitted_signature = true; |
| 322 | 322 | } |
| 323 | errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.args[2].arg_type.?); | |
| 323 | errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.args[2].type.?); | |
| 324 | 324 | } |
| 325 | 325 | if (func.return_type.? != bool) { |
| 326 | 326 | if (!emitted_signature) { |
lib/std/meta.zig+1-1| ... | ... | @@ -1086,7 +1086,7 @@ pub fn ArgsTuple(comptime Function: type) type { |
| 1086 | 1086 | |
| 1087 | 1087 | var argument_field_list: [function_info.args.len]type = undefined; |
| 1088 | 1088 | inline for (function_info.args) |arg, i| { |
| 1089 | const T = arg.arg_type.?; | |
| 1089 | const T = arg.type.?; | |
| 1090 | 1090 | argument_field_list[i] = T; |
| 1091 | 1091 | } |
| 1092 | 1092 |
lib/std/start.zig+1-1| ... | ... | @@ -634,7 +634,7 @@ pub fn callMain() u8 { |
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | pub fn call_wWinMain() std.os.windows.INT { |
| 637 | const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.args[0].arg_type.?; | |
| 637 | const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.args[0].type.?; | |
| 638 | 638 | const hInstance = @ptrCast(MAIN_HINSTANCE, std.os.windows.kernel32.GetModuleHandleW(null).?); |
| 639 | 639 | const lpCmdLine = std.os.windows.kernel32.GetCommandLineW(); |
| 640 | 640 |
src/Sema.zig+2-2| ... | ... | @@ -15316,7 +15316,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 15316 | 15316 | Value.makeBool(is_generic), |
| 15317 | 15317 | // is_noalias: bool, |
| 15318 | 15318 | Value.makeBool(is_noalias), |
| 15319 | // arg_type: ?type, | |
| 15319 | // type: ?type, | |
| 15320 | 15320 | param_ty_val, |
| 15321 | 15321 | }; |
| 15322 | 15322 | param_val.* = try Value.Tag.aggregate.create(params_anon_decl.arena(), param_fields); |
| ... | ... | @@ -18730,7 +18730,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in |
| 18730 | 18730 | const arg_is_generic = arg_val[0].toBool(); |
| 18731 | 18731 | // is_noalias: bool, |
| 18732 | 18732 | const arg_is_noalias = arg_val[1].toBool(); |
| 18733 | // arg_type: ?type, | |
| 18733 | // type: ?type, | |
| 18734 | 18734 | const param_type_opt_val = arg_val[2]; |
| 18735 | 18735 | |
| 18736 | 18736 | if (arg_is_generic) { |
test/behavior/bugs/12885.zig+1-1| ... | ... | @@ -16,7 +16,7 @@ test "ErrorSet comptime_field_ptr" { |
| 16 | 16 | |
| 17 | 17 | const fn_info = .{ |
| 18 | 18 | .args = [_]builtin.Type.Fn.Param{ |
| 19 | .{ .is_generic = false, .is_noalias = false, .arg_type = u8 }, | |
| 19 | .{ .is_generic = false, .is_noalias = false, .type = u8 }, | |
| 20 | 20 | }, |
| 21 | 21 | }; |
| 22 | 22 | const Bar = @Type(.{ |
test/behavior/reflection.zig+3-3| ... | ... | @@ -10,9 +10,9 @@ test "reflection: function return type, var args, and param types" { |
| 10 | 10 | try expect(info.return_type.? == i32); |
| 11 | 11 | try expect(!info.is_var_args); |
| 12 | 12 | try expect(info.args.len == 3); |
| 13 | try expect(info.args[0].arg_type.? == bool); | |
| 14 | try expect(info.args[1].arg_type.? == i32); | |
| 15 | try expect(info.args[2].arg_type.? == f32); | |
| 13 | try expect(info.args[0].type.? == bool); | |
| 14 | try expect(info.args[1].type.? == i32); | |
| 15 | try expect(info.args[2].type.? == f32); | |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 |
test/behavior/type.zig+2-2| ... | ... | @@ -513,8 +513,8 @@ test "Type.Fn" { |
| 513 | 513 | .is_var_args = false, |
| 514 | 514 | .return_type = void, |
| 515 | 515 | .args = &.{ |
| 516 | .{ .is_generic = false, .is_noalias = false, .arg_type = c_int }, | |
| 517 | .{ .is_generic = false, .is_noalias = false, .arg_type = some_ptr }, | |
| 516 | .{ .is_generic = false, .is_noalias = false, .type = c_int }, | |
| 517 | .{ .is_generic = false, .is_noalias = false, .type = some_ptr }, | |
| 518 | 518 | }, |
| 519 | 519 | } }; |
| 520 | 520 |
test/behavior/type_info.zig+6-6| ... | ... | @@ -379,29 +379,29 @@ test "type info: generic function types" { |
| 379 | 379 | const G1 = @typeInfo(@TypeOf(generic1)); |
| 380 | 380 | try expect(G1.Fn.args.len == 1); |
| 381 | 381 | try expect(G1.Fn.args[0].is_generic == true); |
| 382 | try expect(G1.Fn.args[0].arg_type == null); | |
| 382 | try expect(G1.Fn.args[0].type == null); | |
| 383 | 383 | try expect(G1.Fn.return_type == void); |
| 384 | 384 | |
| 385 | 385 | const G2 = @typeInfo(@TypeOf(generic2)); |
| 386 | 386 | try expect(G2.Fn.args.len == 3); |
| 387 | 387 | try expect(G2.Fn.args[0].is_generic == false); |
| 388 | try expect(G2.Fn.args[0].arg_type == type); | |
| 388 | try expect(G2.Fn.args[0].type == type); | |
| 389 | 389 | try expect(G2.Fn.args[1].is_generic == true); |
| 390 | try expect(G2.Fn.args[1].arg_type == null); | |
| 390 | try expect(G2.Fn.args[1].type == null); | |
| 391 | 391 | try expect(G2.Fn.args[2].is_generic == false); |
| 392 | try expect(G2.Fn.args[2].arg_type == u8); | |
| 392 | try expect(G2.Fn.args[2].type == u8); | |
| 393 | 393 | try expect(G2.Fn.return_type == void); |
| 394 | 394 | |
| 395 | 395 | const G3 = @typeInfo(@TypeOf(generic3)); |
| 396 | 396 | try expect(G3.Fn.args.len == 1); |
| 397 | 397 | try expect(G3.Fn.args[0].is_generic == true); |
| 398 | try expect(G3.Fn.args[0].arg_type == null); | |
| 398 | try expect(G3.Fn.args[0].type == null); | |
| 399 | 399 | try expect(G3.Fn.return_type == null); |
| 400 | 400 | |
| 401 | 401 | const G4 = @typeInfo(@TypeOf(generic4)); |
| 402 | 402 | try expect(G4.Fn.args.len == 1); |
| 403 | 403 | try expect(G4.Fn.args[0].is_generic == true); |
| 404 | try expect(G4.Fn.args[0].arg_type == null); | |
| 404 | try expect(G4.Fn.args[0].type == null); | |
| 405 | 405 | try expect(G4.Fn.return_type == null); |
| 406 | 406 | } |
| 407 | 407 |
test/cases/fn_typeinfo_passed_to_comptime_fn.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ fn someFn(arg: ?*c_int) f64 { |
| 9 | 9 | return 8; |
| 10 | 10 | } |
| 11 | 11 | fn foo(comptime info: std.builtin.Type) !void { |
| 12 | try std.testing.expect(info.Fn.args[0].arg_type.? == ?*c_int); | |
| 12 | try std.testing.expect(info.Fn.args[0].type.? == ?*c_int); | |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // run |