From 95a1165d5ae53a00b473fa46040d384f32b8c110 Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi <19735328+chernetskyi@users.noreply.github.com> Date: Wed, 9 Sep 2026 17:48:15 +0200 Subject: [PATCH] refactor: return an integer from Inspector:getId Both call sites feed the result straight into a '%d' format, so the id was converted to a string only for string.format to convert it back. ids already holds integers. The round trip relied on Lua's automatic string to number coercion, which is absent from an interpreter built with LUA_NOCVTS2N. It also made 'tl check' report the two call sites as passing a string where an integer is expected; both of those errors are now gone. The format strings are unchanged and so is the rendered output. --- inspect.lua | 2 +- inspect.tl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inspect.lua b/inspect.lua index 386614c..3066e4f 100644 --- a/inspect.lua +++ b/inspect.lua @@ -265,7 +265,7 @@ function Inspector:getId(v) id = (ids[tv] or 0) + 1 ids[v], ids[tv] = id, id end - return tostring(id) + return id end function Inspector:putValue(v) diff --git a/inspect.tl b/inspect.tl index 4ee3d10..8d30fe3 100644 --- a/inspect.tl +++ b/inspect.tl @@ -257,7 +257,7 @@ local function tabify(inspector: Inspector) puts(inspector.buf, inspector.newline .. rep(inspector.indent, inspector.level)) end -function Inspector:getId(v: any): string +function Inspector:getId(v: any): integer local id: integer = self.ids[v] local ids = self.ids if not id then @@ -265,7 +265,7 @@ function Inspector:getId(v: any): string id = (ids[tv] or 0) + 1 ids[v], ids[tv] = id, id end - return tostring(id) + return id end function Inspector:putValue(v: any)