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 is wrong (because of variable bounds?) #26654

Closed
ulysses4ever opened this issue Mar 29, 2018 · 2 comments · Fixed by #26691
Closed

Subtyping is wrong (because of variable bounds?) #26654

ulysses4ever opened this issue Mar 29, 2018 · 2 comments · Fixed by #26691
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch

Comments

@ulysses4ever
Copy link
Contributor

Julia used to say true (e.g. in 0.6.2) here:

Ref{Union{Int64, Ref{Number}}} <: Ref{Union{Ref{T}, T}} where T

but current master, quite reasonably, says false. If you change, though, Ref to Val it is true again:

Ref{Union{Val{Number}, Int64}} <: Ref{Union{Val{T}, T}} where T

Which seems to be a bug.

@ulysses4ever ulysses4ever changed the title Subtyping is wrong (because of variable bounds)? Subtyping is wrong (because of variable bounds?) Mar 29, 2018
@JeffBezanson JeffBezanson added the types and dispatch Types, subtyping and method dispatch label Mar 29, 2018
@JeffBezanson
Copy link
Member

Seems to be related to Ref being an abstract type.

@JeffBezanson JeffBezanson self-assigned this Mar 29, 2018
@JeffBezanson
Copy link
Member

...which affects the order of the Union components. When the types "line up":

Ref{Union{Val{Number}, Int64}} <: Ref{Union{Val{T}, T}} where T

then we say true, but with the other order on the left:

Ref{Union{Int64, Val{Number}}} <: Ref{Union{Val{T}, T}} where T

we say false.

@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Apr 3, 2018
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.

2 participants