From 82f0f02deefcab90b0b18367554fe534f6da076e Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Mon, 3 Mar 2025 02:36:44 +0100 Subject: [PATCH] add methods to `promote_rule` instead of to `promote_type` It is not allowed to add methods to `promote_type`. --- src/util.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.jl b/src/util.jl index 881dbc7c..63c77845 100644 --- a/src/util.jl +++ b/src/util.jl @@ -121,8 +121,8 @@ macro indextype(ID) Base.Integer(i::$ID) = i.value Base.Int(i::$ID) = i.value Base.convert(::Type{$ID}, i::Integer) = $ID(i) - Base.promote_type(::Type{Int}, ::Type{$ID}) = $ID - Base.promote_type(::Type{$ID}, ::Type{Int}) = $ID + Base.promote_rule(::Type{Int}, ::Type{$ID}) = $ID + Base.promote_rule(::Type{$ID}, ::Type{Int}) = $ID Base.:<(x::$ID, y::$ID) = x.value < y.value Base.:<=(x::$ID, y::$ID) = x.value <= y.value Base.:-(x::$ID, y::$ID) = x.value - y.value