JuliaGraphics / Winston.jl

2D plotting for Julia
MIT License
171 stars 55 forks source link

DimensionMismatch bug #310

Closed my-little-repository closed 1 year ago

my-little-repository commented 2 years ago

I encounter a bug when using the library Winston v0.15.2 and julia 1.7.1. This bug does not appear with Winston v0.15.2 and julia 1.6.5. It was first reported on the julia bug tracker but apparently the problem is due to type piracy on the function range and type Real in Winston code. https://github.com/JuliaLang/julia/issues/43892#issue-1111538374

First, without loading Winston. The following test has worked since julia 0.3.6.

julia> flatten6(A) = [[isa(x,Array) ? flatten6(x) : x for x in A]...;] flatten6 (generic function with 1 method)

julia> flatten6(Any[1,Any[]]) 1-element Vector{Any}: 1

Same but loading Winston first.

julia> using Winston julia> flatten6(A) = [[isa(x,Array) ? flatten6(x) : x for x in A]...;] flatten6 (generic function with 1 method)

julia> flatten6(Any[1,Any[]]) ERROR: DimensionMismatch("tried to assign 0 elements to 2 destinations") Stacktrace: [1] throw_setindex_mismatch(X::Vector{Any}, I::Tuple{Int64}) @ Base ./indices.jl:191 [2] setindex_shape_check @ ./indices.jl:245 [inlined] [3] setindex! @ ./array.jl:910 [inlined] [4] cat_offset1!(A::Vector{Any}, shape::Tuple{Int64}, catdims::Tuple{Bool}, offsets::Tuple{Int64}, x::Vector{Any}) @ Base ./abstractarray.jl:1731 [5] __cat_offset! @ ./abstractarray.jl:1721 [inlined] [6] cat_offset! @ ./abstractarray.jl:1722 [inlined] [7] __cat @ ./abstractarray.jl:1717 [inlined] [8] _cat_t @ ./abstractarray.jl:1713 [inlined] [9] #cat_t#136 @ ./abstractarray.jl:1705 [inlined] [10] _cat @ ./abstractarray.jl:1703 [inlined] [11] #cat#141 @ ./abstractarray.jl:1861 [inlined] [12] vcat(::Int64, ::Vector{Any}) @ Base ./abstractarray.jl:1772 [13] flatten6(A::Vector{Any}) @ Main ./REPL[2]:1 [14] top-level scope @ REPL[3]:1> flatten6(A) = [[isa(x,Array) ? flatten6(x) : x for x in A]...;]

tknopp commented 2 years ago

this package is sailing without a captain. If you want this to get fixed it would be great if you could come up with a pull request that I can then merge.