Skip to content

1.5 beta allunique errors with Unitful #36080

@Tokazama

Description

@Tokazama

On the most recent 1.5 beta release I get the following error.

julia> using Unitful

julia> using Unitful: s

julia> allunique((1.0:1.0:10.0)s)
ERROR: DimensionError: s and 0 are not dimensionally compatible.
Stacktrace:
 [1] convert(::Type{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}}, ::Int64) at /Users/zchristensen/.julia/packages/Unitfu
l/KE9TK/src/conversion.jl:111
 [2] Base.TwicePrecision{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}}(::Int64, ::Int64) at ./twiceprecision.jl:185
 [3] zero(::Type{Base.TwicePrecision{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}}}) at ./twiceprecision.jl:260
 [4] allunique(::StepRangeLen{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}},Base.TwicePrecision{Quantity{Float64,𝐓,Unitful
.FreeUnits{(s,),𝐓,nothing}}},Base.TwicePrecision{Quantity{Float64,𝐓,Unitful.FreeUnits{(s,),𝐓,nothing}}}}) at ./set.jl:390
 [5] top-level scope at REPL[3]:1

This does raise some things that could probably be addressed in Unitful.jl but I wonder if it would make more sense to just have allunique(::AbstractRange) = true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions