| ... | ... | @@ -243,6 +243,9 @@ pub fn formatType( |
| 243 | 243 | } |
| 244 | 244 | return format(context, Errors, output, "{}@{x}", @typeName(T.Child), @ptrToInt(&value)); |
| 245 | 245 | }, |
| 246 | builtin.TypeId.Fn => { |
| 247 | return format(context, Errors, output, "{}@{x}", @typeName(T), @ptrToInt(value)); |
| 248 | }, |
| 246 | 249 | else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"), |
| 247 | 250 | } |
| 248 | 251 | } |
| ... | ... | @@ -1013,6 +1016,10 @@ test "fmt.format" { |
| 1013 | 1016 | const value = @intToPtr(fn () void, 0xdeadbeef); |
| 1014 | 1017 | try testFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", value); |
| 1015 | 1018 | } |
| 1019 | { |
| 1020 | const value = @intToPtr(fn () void, 0xdeadbeef); |
| 1021 | try testFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", value); |
| 1022 | } |
| 1016 | 1023 | try testFmt("buf: Test \n", "buf: {s5}\n", "Test"); |
| 1017 | 1024 | try testFmt("buf: Test\n Other text", "buf: {s}\n Other text", "Test"); |
| 1018 | 1025 | try testFmt("cstr: Test C\n", "cstr: {s}\n", c"Test C"); |