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

subtype broken for TypeVar with Union #11803

Closed
timholy opened this issue Jun 21, 2015 · 4 comments
Closed

subtype broken for TypeVar with Union #11803

timholy opened this issue Jun 21, 2015 · 4 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@timholy
Copy link
Sponsor Member

timholy commented Jun 21, 2015

# Good
julia> T = TypeVar(:T, Int, true)
T<:Int64

julia> T <: Int
true

# Bad
julia> T = TypeVar(:T, Union(Int,Float64), true)
T<:Union(Int64,Float64)

julia> T <: Union(Int,Float64)
false
@JeffBezanson
Copy link
Sponsor Member

Does this trigger any "real code" problem (other than #11015)?

I'm afraid the only real fix is in https://github.com/JuliaLang/julia/blob/master/examples/juliatypes.jl

@timholy
Copy link
Sponsor Member Author

timholy commented Jun 21, 2015

I was starting to work on efficient algorithms for multiplication with SubArrays of SparseMatrixCSCs. You can write particularly-efficient algorithms if the slices are along columns, so I wanted to define this:

julia> typealias SubcolSparseMatrix{Tv,Ti,ColI<:Base.ViewIndex} SubArray{Tv,2,SparseMatrixCSC{Tv,Ti},Tuple{Colon,ColI}}
ERROR: TypeError: SubArray: in I, expected I<:Tuple{Vararg{Union{Range{Int64},Colon,Array{Int64,1},Int64}}}, got Type{Tuple{Colon,ColI<:Union{Range{Int64},Colon,Array{Int64,1},Int64}}}

@timholy
Copy link
Sponsor Member Author

timholy commented Jun 21, 2015

I'm sure the type system rework will be the best fix, but this PR is close. The problem I've generally encountered is that often when I fix a bug in the C code, then some types "leak out" of inference in ways that they formerly hadn't. I fixed a couple of those in this PR (see the changes to inference.jl and essentials.jl), but then I ran out of time.

@ihnorton ihnorton added the types and dispatch Types, subtyping and method dispatch label Jun 25, 2015
@JeffBezanson
Copy link
Sponsor Member

closed by #18457

@vtjnash vtjnash mentioned this issue Jan 16, 2017
53 tasks
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 17, 2017
mauro3 added a commit to mauro3/julia that referenced this issue Jan 18, 2017
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#11803, JuliaLang#12721

Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved
yet but needs tests triggering it.
mauro3 added a commit to mauro3/julia that referenced this issue Jan 20, 2017
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#12721

For JuliaLang#11803 it was decidided that no tests are needed.

Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved
yet but needs new tests triggering it.
mauro3 added a commit to mauro3/julia that referenced this issue Jan 20, 2017
Added tests for issues JuliaLang#12580, JuliaLang#18348, JuliaLang#13165, JuliaLang#12721

For JuliaLang#11803 it was decidided that no tests are needed.

Enabled extra tests for JuliaLang#11840, however, that isssue is not resolved
yet but needs new tests triggering it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants