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: equivalent types behave differently when matching with diagonal variables #33137

Closed
abolotina opened this issue Sep 2, 2019 · 2 comments · Fixed by #53034
Closed
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing types and dispatch Types, subtyping and method dispatch

Comments

@abolotina
Copy link

In Julia 1.2.0,

julia> (Tuple{Q,Int} where Q<:Int) <: Tuple{T,T} where T
false

julia> (Tuple{Int,Int}) <: Tuple{T,T} where T
true

I think the first check should return true because the types on the left-hand side are equivalent:

julia> (Tuple{Q,Int} where Q<:Int) <: Tuple{Int,Int}
true

julia> Tuple{Int,Int} <: Tuple{Q,Int} where Q<:Int
true

Version info:

Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i3-7100U CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
@Keno Keno added bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch labels Sep 3, 2019
@JeffBezanson JeffBezanson self-assigned this Jan 3, 2020
@Moelf
Copy link
Contributor

Moelf commented Oct 30, 2023

any update on this? the pattern seems quite common

@adienes
Copy link
Contributor

adienes commented Oct 31, 2023

+1
once encountered when toying with where to learn how subtyping works because I'm too stubborn to RTFM, and this confused the crap out of me before I knew was bug

@nsajko nsajko added the correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing label Jan 25, 2024
N5N3 added a commit that referenced this issue Jan 26, 2024
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 correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants