Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Inadequate support of `promote_rule` for non-concrete types

Abierto
#343 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
julia
Área
backend

Línea de trabajo

Reproduce the listed promote_rule cases in the Julia REPL and read the handling in ColorTypes.jl. Compare the behavior with issue #342, then establish expected results for the examples, including avoiding StackOverflowError. Done means the non-concrete promotion cases behave consistently without the reported errors.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

For better or worse, PR #207 is the most significant change in FPN v0.9.
However the current promote_rule for non-concrete types is somewhat imperfect.
In ColorTypes.jl, I am keenly aware that the handling of non-concrete types can lead to chaos.
Here, I’d like to think about ways to make things a little better, as long as they don’t go against common sense.

julia> promote_rule(Normed{UInt8, 8}, Fixed{Int8, 7})
Float32

julia> promote_rule(Normed{UInt8}, Fixed{Int8})
Union{} # -> Float32

julia> promote_rule(Normed{UInt8}, Normed{UInt8})
Union{} # -> Normed{UInt8}

julia> promote_rule(Normed{UInt8}, Normed{UInt16})
Union{} # -> Normed{UInt16}

julia> promote_rule(Normed{UInt8}, Normed)
Union{} # -> Normed

julia> promote_rule(Normed{UInt8}, Normed{Union{UInt8, UInt16}})
Union{} # -> Normed (Any desire to make this more strict is a path to despair.)

julia> promote_rule(Normed{UInt8}, FixedPoint)
Union{} # -> FixedPoint

julia> promote_rule(Normed{UInt8}, Float64)
Float64

julia> promote_rule(Normed, Float64)
ERROR: StackOverflowError # -> BigFloat

julia> promote_rule(Normed{UInt8}, Int8)
Float32

julia> promote_rule(Normed, Int8)
Normed # -> BigFloat

Some of the unnatural promotions or stack overflow errors are caused by issue #342. In other words, fixing issue #342 will resolve some of these issues.

Lenguaje dominante
Julia
Estrellas
95
Forks
38
Merge medio
16 h 31 min
PR fusionados (30 d)
9

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de JuliaMath/FixedPointNumbers.jl

Todos los issues de JuliaMath/FixedPointNumbers.jl

Issues similares

Más issues de Julia

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.