Open dlfivefifty opened 6 years ago
This is this assertion firing: https://github.com/JuliaLang/julia/blob/daa58bb183799aac11f069e5b17a689e7fb8ec1b/base/inference.jl#L995
The types being compared are
t = Tuple{typeof(Base.LinAlg.A_mul_B!),
T,
ToeplitzMatrices.Toeplitz{T, Base.Complex{Float32}},
Base.SubArray{_, 2, _, _, true} where _<:Tuple{Vararg{Union{Int64, Base.AbstractRange{Int64}, Base.AbstractCartesianIndex{N} where N}, N} where N} where _<:Union{Base.ReshapedArray{T, N, A, MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}, N} where N} where A<:Union{Base.SubArray{T, N, P, I, true} where I<:Tuple{Union{Base.Slice{T} where T<:(Base.AbstractUnitRange{T} where T), Base.UnitRange{T} where T<:Real}, Vararg{Any, N} where N} where P where N where T, DenseArray{T, N} where N where T} where N where T, DenseArray{T, N} where N where T} where _,
T,
Base.SubArray{T, 2, _, _, false} where _<:Tuple{Vararg{Union{Int64, Base.AbstractRange{Int64}, Base.AbstractCartesianIndex{N} where N}, N} where N} where _<:Union{Base.ReshapedArray{T, N, A, MI} where MI<:Tuple{Vararg{Base.MultiplicativeInverses.SignedMultiplicativeInverse{Int64}, N} where N} where A<:Union{Base.SubArray{T, N, P, I, true} where I<:Tuple{Union{Base.Slice{T} where T<:(Base.AbstractUnitRange{T} where T), Base.UnitRange{T} where T<:Real}, Vararg{Any, N} where N} where P where N where T, DenseArray{T, N} where N where T} where N where T, DenseArray{T, N} where N where T}
} where T<:Number
r = Tuple{typeof(Base.LinAlg.A_mul_B!),
T,
ToeplitzMatrices.Toeplitz{T, S} where S<:Number where T<:Number,
Base.SubArray{T, N, P, I, L} where L where I where P where N where T,
T,
Base.SubArray{T, N, P, I, L} where L where I where P where N where T
} where T<:Number
Unfortunately, these don't parse as they print, but I think t <: r
should actually be true, and the reduced example would be
julia> (Tuple{T,Ref{T},T} where T) <: (Tuple{T,Ref,T} where T)
false
which I think should also be true.
No, as per discussion on slack, the subtyping relation here is correct, but limit_type_size
apparently doesn't keep track of variables that may or may not fall under the diagonal rule. In particular, as T
is used both directly in the Tuple
and indirectly via Toeplitz
in t
, it is not restricted to a concrete type there. But in r
, all uses of T
(the one bound by the outer where
) are in covariant position, hence it is restricted to a concrete type.
A possible fix could be to replace T
with <:T
after the current algorithm has run, provided the situation is recognized. Alternatively, the assertion could be replaced by a bail-out returning Any
, but that could come as a nasty surprise sometimes.
Also a bug in typejoin
:
julia> typejoin(Tuple{T, Ref{T}, T} where T, Tuple{T, Ref, T} where T)
Tuple{T, Ref, T} where T
... or how I learned to start worrying and loathe the diagonal rule ...
So we would need to establish whether any type variables are subject to the diagonal rule after but not before widening/joining/merging and then replace their occurrences with <:T
?
Hi,
I Retested this today in Julia 1.6.2 and the test seemed to pass, so maybe this bug can be closed?
julia> Pkg.test("ToeplitzMatrices")
Testing ToeplitzMatrices
Status `/private/var/folders/g9/19fjd43s4q3005py750lk2l40000gn/T/jl_oc3l73/Project.toml`
[621f4979] AbstractFFTs v1.0.1
[7a1cc6ca] FFTW v1.4.5
[2913bbd2] StatsBase v0.33.10
[c751599d] ToeplitzMatrices v0.7.0
[37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
[44cfe95a] Pkg `@stdlib/Pkg`
[8dfed614] Test `@stdlib/Test`
Status `/private/var/folders/g9/19fjd43s4q3005py750lk2l40000gn/T/jl_oc3l73/Manifest.toml`
[621f4979] AbstractFFTs v1.0.1
[34da2185] Compat v3.38.0
[9a962f9c] DataAPI v1.9.0
[864edb3b] DataStructures v0.18.10
[7a1cc6ca] FFTW v1.4.5
[692b3bcd] JLLWrappers v1.3.0
[e1d29d7a] Missings v1.0.2
[bac558e1] OrderedCollections v1.4.1
[21216c6a] Preferences v1.2.2
[189a3867] Reexport v1.2.2
[a2af1166] SortingAlgorithms v1.0.1
[82ae8749] StatsAPI v1.0.0
[2913bbd2] StatsBase v0.33.10
[c751599d] ToeplitzMatrices v0.7.0
[f5851436] FFTW_jll v3.3.10+0
[1d5cc7b8] IntelOpenMP_jll v2018.0.3+2
[856f044c] MKL_jll v2021.1.1+2
[0dad84c5] ArgTools `@stdlib/ArgTools`
[56f22d72] Artifacts `@stdlib/Artifacts`
[2a0f44e3] Base64 `@stdlib/Base64`
[ade2ca70] Dates `@stdlib/Dates`
[8bb1440f] DelimitedFiles `@stdlib/DelimitedFiles`
[8ba89e20] Distributed `@stdlib/Distributed`
[f43a241f] Downloads `@stdlib/Downloads`
[b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
[4af54fe1] LazyArtifacts `@stdlib/LazyArtifacts`
[b27032c2] LibCURL `@stdlib/LibCURL`
[76f85450] LibGit2 `@stdlib/LibGit2`
[8f399da3] Libdl `@stdlib/Libdl`
[37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
[56ddb016] Logging `@stdlib/Logging`
[d6f4376e] Markdown `@stdlib/Markdown`
[a63ad114] Mmap `@stdlib/Mmap`
[ca575930] NetworkOptions `@stdlib/NetworkOptions`
[44cfe95a] Pkg `@stdlib/Pkg`
[de0858da] Printf `@stdlib/Printf`
[3fa0cd96] REPL `@stdlib/REPL`
[9a3f8284] Random `@stdlib/Random`
[ea8e919c] SHA `@stdlib/SHA`
[9e88b42a] Serialization `@stdlib/Serialization`
[1a1011a3] SharedArrays `@stdlib/SharedArrays`
[6462fe0b] Sockets `@stdlib/Sockets`
[2f01184e] SparseArrays `@stdlib/SparseArrays`
[10745b16] Statistics `@stdlib/Statistics`
[fa267f1f] TOML `@stdlib/TOML`
[a4e569a6] Tar `@stdlib/Tar`
[8dfed614] Test `@stdlib/Test`
[cf7118a7] UUIDs `@stdlib/UUIDs`
[4ec0a83e] Unicode `@stdlib/Unicode`
[deac9b47] LibCURL_jll `@stdlib/LibCURL_jll`
[29816b5a] LibSSH2_jll `@stdlib/LibSSH2_jll`
[c8ffd9c3] MbedTLS_jll `@stdlib/MbedTLS_jll`
[14a3606d] MozillaCACerts_jll `@stdlib/MozillaCACerts_jll`
[83775a58] Zlib_jll `@stdlib/Zlib_jll`
[8e850ede] nghttp2_jll `@stdlib/nghttp2_jll`
[3f19e933] p7zip_jll `@stdlib/p7zip_jll`
Testing Running tests...
Test Summary: | Pass Total
Toeplitz: Real general square | 10 10
Test Summary: | Pass Total
Toeplitz: Complex general square | 10 10
Test Summary: | Pass Total
Toeplitz: Real circulant | 10 10
Test Summary: | Pass Total
Toeplitz: Complex circulant | 10 10
Test Summary: | Pass Total
Toeplitz: Real upper triangular | 10 10
Test Summary: | Pass Total
Toeplitz: Complex upper triangular | 10 10
Test Summary: | Pass Total
Toeplitz: Real lower triangular | 10 10
Test Summary: | Pass Total
Toeplitz: Complex lower triangular | 10 10
Test Summary: | Pass Total
Mixed types | 6 6
Test Summary: | Pass Total
Real general rectangular | 2 2
Test Summary: | Pass Total
Complex general rectangular | 2 2
Test Summary: | Pass Total
Symmetric Toeplitz | 9 9
Test Summary: | Pass Total
Hankel | 27 27
Test Summary: | Pass Total
Convert | 25 25
Test Summary: | Pass Total
Constructors | 17 17
T
https://github.com/JuliaLang/julia/issues/24582#issuecomment-344258077 looks like it is still the same, or?
I recently wrote a small collection of helper functions, one of which might be useful to help solve this: https://github.com/vtjnash/julia/commit/fa2f102cd2e2c758626ce1f9152d9692144d3c79#
@topolarity you might be interested in this ;), Also I can confirm this is still wrong.
I get the error
using the
dl/0.7
branch of ToeplitzMatrices.jl on the last build o f0.7. The full stack trace is below, and version info at the bottom.