From 002d7303d3532d0784f6effe5c2ffc433b133dfa Mon Sep 17 00:00:00 2001 From: Clem Cords Date: Thu, 8 Feb 2024 19:26:33 +0100 Subject: [PATCH] fixed n digits conversion for enums #69 --- src/Mousetrap.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Mousetrap.jl b/src/Mousetrap.jl index a642bb2..4d4e51b 100644 --- a/src/Mousetrap.jl +++ b/src/Mousetrap.jl @@ -444,8 +444,9 @@ module Mousetrap enum_sym = QuoteNode(enum) to_int_name = Symbol(enum) * :_to_int + push!(out.args, :(Base.ndigits(x::$enum) = ndigits(Mousetrap.detail.$to_int_name(x)))) push!(out.args, :(Base.string(x::$enum) = string(Mousetrap.detail.$to_int_name(x)))) - push!(out.args, :(Base.convert(::Type{Integer}, x::$enum) = Integer(Mousetrap.detail.to_int_name(x)))) + push!(out.args, :(Base.convert(::Type{Integer}, x::$enum) = Integer(Mousetrap.detail.$to_int_name(x)))) push!(out.args, :(Base.instances(x::Type{$enum}) = [$(names...)])) push!(out.args, :(Base.show(io::IO, x::Type{$enum}) = print(io, (isdefined(Main, $enum_sym) ? "" : "Mousetrap.") * $enum_str))) push!(out.args, :(Base.show(io::IO, x::$enum) = print(io, string($enum) * "(" * string(convert(Int64, x)) * ")")))