Closed
Description
This is easiest to show in code. I will make a fresh environment and try to initialize a circular buffer:
(@v1.10) pkg> activate --temp
Activating new project at `/tmp/jl_7Wbc1W`
(jl_7Wbc1W) pkg> add DataStructures
Updating registry at `~/.julia/registries/General.toml`
Resolving package versions...
Updating `/tmp/jl_7Wbc1W/Project.toml`
⌃ [864edb3b] + DataStructures v0.18.15
Updating `/tmp/jl_7Wbc1W/Manifest.toml`
⌃ [34da2185] + Compat v4.10.1
⌃ [864edb3b] + DataStructures v0.18.15
[bac558e1] + OrderedCollections v1.6.3
[2a0f44e3] + Base64
[b77e0a4c] + InteractiveUtils
[d6f4376e] + Markdown
[9a3f8284] + Random
[ea8e919c] + SHA v0.7.0
[cf7118a7] + UUIDs
Info Packages marked with ⌃ have new versions available and may be upgradable.
julia> using DataStructures
But using Int32
or Int16
errors:
julia> CircularBuffer{Float32}(Int32(10))
ERROR: MethodError: no method matching CircularBuffer{Float32}(::Int32)
Closest candidates are:
CircularBuffer{T}(::Int64) where T
@ DataStructures ~/.julia/packages/DataStructures/MKv4P/src/circular_buffer.jl:16
Stacktrace:
[1] top-level scope
@ REPL[10]:1
julia> CircularBuffer{Float32}(Int16(10))
ERROR: MethodError: no method matching CircularBuffer{Float32}(::Int16)
Closest candidates are:
CircularBuffer{T}(::Int64) where T
@ DataStructures ~/.julia/packages/DataStructures/MKv4P/src/circular_buffer.jl:16
Stacktrace:
[1] top-level scope
@ REPL[11]:1
Int64 works as expected:
julia> CircularBuffer{Float32}(Int64(10))
0-element CircularBuffer{Float32}
This could easily be fixed, by I wanted to ask some questions before making a PR:
- Do we agree that this is unwanted behaviour?
- Is it possible that this should be fixed for a class of structs defined in this package, or is it likely to only affect CircularBuffers?
Metadata
Metadata
Assignees
Labels
No labels
Activity