Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in type widening #24582

Open
dlfivefifty opened this issue Nov 12, 2017 · 8 comments
Open

bug in type widening #24582

dlfivefifty opened this issue Nov 12, 2017 · 8 comments
Labels
compiler:inference Type inference types and dispatch Types, subtyping and method dispatch

Comments

@dlfivefifty
Copy link
Contributor

I get the error

Internal error: encountered unexpected error in runtime:
MethodError(f=typeof(Base.string)(), args=(Expr(:<:, :t, :r)::Any,), world=0x0000000000000b2e)

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.

julia> Pkg.test("ToeplitzMatrices")
INFO: Computing test dependencies for ToeplitzMatrices...
INFO: No packages to install, update or remove
INFO: Testing ToeplitzMatrices
Internal error: encountered unexpected error in runtime:
MethodError(f=typeof(Base.string)(), args=(Expr(:<:, :t, :r)::Any,), world=0x0000000000000b2e)
rec_backtrace at /Users/solver/Projects/julia7/src/stackwalk.c:94
record_backtrace at /Users/solver/Projects/julia7/src/task.c:246 [inlined]
jl_throw at /Users/solver/Projects/julia7/src/task.c:577
jl_method_error_bare at /Users/solver/Projects/julia7/src/gf.c:1507
jl_method_error at /Users/solver/Projects/julia7/src/gf.c:1525
jl_lookup_generic_ at /Users/solver/Projects/julia7/src/gf.c:1987
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2007
limit_type_size at ./inference.jl:995
jlcall_limit_type_size_1627 at /Users/solver/Projects/julia7/usr/lib/julia/sys.dylib (unknown line)
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:1979
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
abstract_interpret at ./inference.jl:2681
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3314
typeinf at ./inference.jl:3445
typeinf_edge at ./inference.jl:3183
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:2008
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
abstract_interpret at ./inference.jl:2681
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3314
typeinf at ./inference.jl:3445
typeinf_edge at ./inference.jl:3183
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:2008
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
abstract_interpret at ./inference.jl:2681
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3314
typeinf at ./inference.jl:3445
typeinf_edge at ./inference.jl:3183
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:2008
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
#201 at ./<missing>:0
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
next at ./generator.jl:47
copy! at ./abstractarray.jl:574
_collect at ./array.jl:571
collect at ./array.jl:568
abstract_eval_call at ./inference.jl:2475
abstract_eval at ./inference.jl:2524
#201 at ./<missing>:0
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
next at ./generator.jl:47
copy! at ./abstractarray.jl:574
_collect at ./array.jl:571
collect at ./array.jl:568
abstract_eval_call at ./inference.jl:2475
abstract_eval at ./inference.jl:2524
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3376
typeinf at ./inference.jl:3445
typeinf_edge at ./inference.jl:3183
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:2008
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
abstract_interpret at ./inference.jl:2681
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3314
typeinf at ./inference.jl:3445
typeinf_edge at ./inference.jl:3183
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:2008
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
abstract_interpret at ./inference.jl:2681
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3314
typeinf at ./inference.jl:3445
typeinf_edge at ./inference.jl:3183
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_method at ./inference.jl:2008
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call_gf_by_type at ./inference.jl:1887
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_call at ./inference.jl:2471
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_eval_call at ./inference.jl:2501
abstract_eval at ./inference.jl:2524
#201 at ./<missing>:0
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
next at ./generator.jl:47
copy! at ./abstractarray.jl:574
_collect at ./array.jl:571
collect at ./array.jl:568
abstract_eval_call at ./inference.jl:2475
abstract_eval at ./inference.jl:2524
#201 at ./<missing>:0
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
next at ./generator.jl:47
copy! at ./abstractarray.jl:574
_collect at ./array.jl:571
collect at ./array.jl:568
abstract_eval_call at ./inference.jl:2475
abstract_eval at ./inference.jl:2524
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
abstract_interpret at ./inference.jl:2673
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
typeinf_work at ./inference.jl:3314
typeinf at ./inference.jl:3445
typeinf_ext at ./inference.jl:3277
jlcall_typeinf_ext_0 at /Users/solver/Projects/julia7/usr/lib/julia/sys.dylib (unknown line)
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
jl_apply at /Users/solver/Projects/julia7/src/./julia.h:1475 [inlined]
jl_apply_with_saved_exception_state at /Users/solver/Projects/julia7/src/rtutils.c:252
jl_type_infer at /Users/solver/Projects/julia7/src/gf.c:263
jl_toplevel_eval_flex at /Users/solver/Projects/julia7/src/toplevel.c:697
jl_parse_eval_all at /Users/solver/Projects/julia7/src/ast.c:793
jl_load at /Users/solver/Projects/julia7/src/toplevel.c:734 [inlined]
jl_load_ at /Users/solver/Projects/julia7/src/toplevel.c:741
include_relative at ./loading.jl:509
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
include at ./sysimg.jl:15
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
process_options at ./client.jl:334
_start at ./client.jl:400
jl_call_fptr_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:380 [inlined]
jl_call_method_internal at /Users/solver/Projects/julia7/src/./julia_internal.h:399 [inlined]
jl_apply_generic at /Users/solver/Projects/julia7/src/gf.c:2010
true_main at /Users/solver/Projects/julia7/usr/bin/julia (unknown line)
main at /Users/solver/Projects/julia7/usr/bin/julia (unknown line)
ERROR: LoadError: UndefVarError: #3#first_iteration not defined
Stacktrace:
 [1] top-level scope at ./<missing>:1031
 [2] include_relative(::Module, ::String) at ./loading.jl:509
 [3] include(::Module, ::String) at ./sysimg.jl:15
 [4] process_options(::Base.JLOptions) at ./client.jl:334
 [5] _start() at ./client.jl:400
in expression starting at /Users/solver/.julia/v0.7/ToeplitzMatrices/test/runtests.jl:14
=============================================[ ERROR: ToeplitzMatrices ]==============================================

failed process: Process(`/Users/solver/Projects/julia7/usr/bin/julia -Cnative -J/Users/solver/Projects/julia7/usr/lib/julia/sys.dylib --compile=yes --depwarn=yes --code-coverage=none --color=yes --compiled-modules=yes --check-bounds=yes --warn-overwrite=yes --startup-file=yes /Users/solver/.julia/v0.7/ToeplitzMatrices/test/runtests.jl`, ProcessExited(1)) [1]

======================================================================================================================
INFO: No packages to install, update or remove
ERROR: ToeplitzMatrices had test errors

julia> versioninfo()
Julia Version 0.7.0-DEV.2492
Commit 6a23e234e6 (2017-11-11 22:42 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin17.2.0)
  CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)
Environment:
  JULIA_VERSION = 0.6
@martinholters
Copy link
Member

This is this assertion firing:

@assert t <: r

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.

@martinholters
Copy link
Member

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.

@martinholters martinholters added the compiler:inference Type inference label Nov 14, 2017
@vtjnash vtjnash changed the title 0.7: Internal error in ToeplitzMatrices.jl bug in type widening Nov 14, 2017
@vtjnash vtjnash added the types and dispatch Types, subtyping and method dispatch label Nov 14, 2017
@vtjnash
Copy link
Member

vtjnash commented Nov 14, 2017

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

@martinholters
Copy link
Member

... 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?

@User-764Q
Copy link

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

@KristofferC
Copy link
Member

#24582 (comment) looks like it is still the same, or?

@vtjnash
Copy link
Member

vtjnash commented Mar 3, 2023

I recently wrote a small collection of helper functions, one of which might be useful to help solve this: vtjnash@fa2f102

@gbaraldi
Copy link
Member

gbaraldi commented Mar 4, 2023

@topolarity you might be interested in this ;),
Also I can confirm this is still wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

6 participants