Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Inadequate support of `promote_rule` for non-concrete types

Đang mở
#343 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
julia
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Julia
Star
95
Fork
38
Merge trung bình
16 giờ 31 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của JuliaMath/FixedPointNumbers.jl

Tất cả issue của JuliaMath/FixedPointNumbers.jl

Issue tương tự

Thêm issue về Julia

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.