From 32ca50a097c09da8b2bbba4d809b84b419e4c04e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Wed, 24 May 2023 20:54:30 +0100 Subject: [PATCH] Fix special printing for certain named types with `fmt.printf` related procedures --- core/fmt/fmt.odin | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 8a5f54516..b82789813 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -2647,18 +2647,10 @@ fmt_arg :: proc(fi: ^Info, arg: any, verb: rune) { } } - - custom_types: switch a in arg { - case runtime.Source_Code_Location: - if fi.hash && verb == 'v' { - io.write_string(fi.writer, a.file_path, &fi.n) - io.write_byte(fi.writer, '(', &fi.n) - io.write_i64(fi.writer, i64(a.line), 10, &fi.n) - io.write_byte(fi.writer, ':', &fi.n) - io.write_i64(fi.writer, i64(a.column), 10, &fi.n) - io.write_byte(fi.writer, ')', &fi.n) - return - } + arg_info := type_info_of(arg.id) + if info, ok := arg_info.variant.(runtime.Type_Info_Named); ok { + fmt_named(fi, arg, verb, info) + return } base_arg := arg