Skip to content

Broadcasting picks wrong method in 1.8.1 #46722

Closed
@sostock

Description

@sostock

See PainterQubits/Unitful.jl#557:

julia> using Unitful;

julia> [1.0u"m", 2.0u"m"] .+ 3.0u"m"
2-element Vector{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}:
 4.0 m
 5.0 m

julia> Any[1.0u"m", 2.0u"m"] .+ 3.0u"m"
ERROR: + not defined for Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}
[...]
  • [1.0u"m", 2.0u"m"] .+ 3.0u"m" uses
    +(x::AbstractQuantity{S,D,U}, y::AbstractQuantity{T,D,U}) where {S,T,D,U} in Unitful at src/quantities.jl:125
  • Any[1.0u"m", 2.0u"m"] .+ 3.0u"m" uses
    +(x::T, y::T) where T<:Number in Base at promotion.jl:463` and therefore errors.

It worked on 1.8.0 and is broken on 1.8.1 and master. For the regression from 1.8.0 to 1.8.1, bisect blames 5d03fcd, which is the backport of #46535.

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorpriorityThis should be addressed urgentlyregressionRegression in behavior compared to a previous version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions