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

type-intersection environment bug #23017

Closed
vtjnash opened this issue Jul 29, 2017 · 5 comments
Closed

type-intersection environment bug #23017

vtjnash opened this issue Jul 29, 2017 · 5 comments
Assignees
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@vtjnash
Copy link
Member

vtjnash commented Jul 29, 2017

The result is missing the where T

julia> z2(::Type{T} where T<:Tuple{Vararg{S}}) where {S} = S
z2 (generic function with 1 method)

julia> z2(Tuple{Vararg{Complex{T}}} where T)
Complex{T}
@vtjnash vtjnash added the types and dispatch Types, subtyping and method dispatch label Jul 29, 2017
@vtjnash
Copy link
Member Author

vtjnash commented Jul 29, 2017

When this is fixed, the method

essentials.jl:69
convert(::Type{Tuple{Vararg{T}}}, x::Tuple) where {T} = cnvt_all(T, x...)

Should be re-written with the above form, so that it accepts any NTuple, and not just ones where N is unknown. For example, Tuple{Complex, Vararg{Complex}} and Tuple{Complex, Complex} should both also work with calling this method.

@JeffBezanson
Copy link
Member

JeffBezanson commented Jul 29, 2017

Yes, the free typevar there is definitely a bug.

We also have this behavior:

julia> Tuple{Complex,Complex} <: NTuple
false

Basically NTuple is a "diagonal" type. So I'm not sure those types would(/should) match this method.

@vtjnash
Copy link
Member Author

vtjnash commented Jul 29, 2017

Oops, that wasn't supposed to be a diagonal type, I copied the wrong example. The types should have been constrained to be the same: Tuple{Complex{T}, Complex{T}} where T like in the OP.

@JeffBezanson
Copy link
Member

This is now a method error. Fixed by #23691 and #23643?

@vtjnash
Copy link
Member Author

vtjnash commented Sep 19, 2017

SGTM

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