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

Propagate parameter constraints to derived UnionAlls #25361

Closed
timholy opened this issue Jan 2, 2018 · 2 comments
Closed

Propagate parameter constraints to derived UnionAlls #25361

timholy opened this issue Jan 2, 2018 · 2 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@timholy
Copy link
Member

timholy commented Jan 2, 2018

Very close to #9441 (open), #6721 (closed), and several related issues.

julia> struct Thing{A<:AbstractUnitRange,B} end

julia> const ThingInt{A} = Thing{A,Int}
Thing{A,Int64} where A

julia> ThingInt <: Thing
false

julia> ThingInt{<:AbstractUnitRange} <: Thing
true

yet

julia> ThingInt{Float64}
ERROR: TypeError: in Thing, in A, expected A<:AbstractUnitRange, got Type{Float64}

Where this seems like it could be slightly tricky is something like this:

julia> struct DimsThing{Dims<:Tuple{Vararg{Int}},B} end

julia> const DimsInt{N} = DimsThing{<:NTuple{N},Int}
DimsThing{#s1,Int64} where #s1<:(Tuple{Vararg{T,N}} where T) where N

julia> DimsInt <: DimsThing
false

However, this too seems pretty easily solved by computing the type intersection of the RHS with the constraints in the type definition.

@timholy timholy added the types and dispatch Types, subtyping and method dispatch label Jan 2, 2018
@JeffBezanson
Copy link
Member

Basically a dup of #6383 I think.

@timholy
Copy link
Member Author

timholy commented Jan 2, 2018

Yeah, it's the same. I'll close this and link here, since this is a pretty easy test case. Thanks for finding that.

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

No branches or pull requests

2 participants