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

subtyping bug with comparing diagonal and triangular tuples #26108

Closed
vtjnash opened this issue Feb 19, 2018 · 2 comments · Fixed by #34272
Closed

subtyping bug with comparing diagonal and triangular tuples #26108

vtjnash opened this issue Feb 19, 2018 · 2 comments · Fixed by #34272
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch

Comments

@vtjnash
Copy link
Member

vtjnash commented Feb 19, 2018

T, S = Tuple{T, T, Any} where T, Tuple{T, T, Vector{T}} where T
(Tuple{T, T, Any} where T, Tuple{T, T, Array{T, 1}} where T)

julia> S <: T
true

However, it's easy to find types (such as R = Tuple{Int16, Int32, Vector{Any}}) for which returning true here makes inference unsound

@vtjnash vtjnash added bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch labels Feb 19, 2018
@martinholters
Copy link
Member

And of course (at the risk of pointing out the obvious) this breaks transitivity:

julia> R<:S<:T
true

julia> R<:T
false

@julbinb
Copy link

julbinb commented Feb 19, 2018

Interesting: this looks almost exactly as a fixed transitivity bug #24166 I reported earlier. If use Vector instead of Any, subtype check is correct:

julia> T1, S1 = Tuple{T, T, Vector} where T, Tuple{T, T, Vector{T}} where T
(Tuple{T,T,Array{T,1} where T} where T, Tuple{T,T,Array{T,1}} where T)

julia> S1 <: T1
false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants