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

convert to non-varargs Tuple ignores trailing element mismatch #17198

Closed
vtjnash opened this issue Jun 29, 2016 · 6 comments
Closed

convert to non-varargs Tuple ignores trailing element mismatch #17198

vtjnash opened this issue Jun 29, 2016 · 6 comments
Labels
priority This should be addressed urgently regression Regression in behavior compared to a previous version

Comments

@vtjnash
Copy link
Member

vtjnash commented Jun 29, 2016

this should be an error, since a 3-element tuple can't be converted to a 1-element tuple, but instead it just ignored the trailing elements:

julia> convert(Tuple{Int}, (1.0, 2.0, 3.0))
(1,2.0,3.0)
@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label Jun 29, 2016
@JeffBezanson
Copy link
Member

Worked in 0.4. This is absurd.

@JeffBezanson
Copy link
Member

Reduction:

julia> f(::Type{Tuple}) = 0

julia> methods(f, (Type{Tuple{}},))
# 1 method for generic function "f":
f(::Type{Tuple}) at REPL[5]:1

Though interestingly f(Tuple{}) fails with a method error, while convert(Tuple{}, (1, 2)) goes through.

@JeffBezanson JeffBezanson added the priority This should be addressed urgently label Jun 29, 2016
@vtjnash
Copy link
Member Author

vtjnash commented Jun 30, 2016

More reduced:

julia> typeintersect(Type{Tuple}, Type{Tuple{}})
Type{Tuple{}}

and

julia> Type{Tuple{}} <: Type{Tuple}
true

@Keno
Copy link
Member

Keno commented Jun 30, 2016

This issue seems familiar. Did we something related before?

@timholy
Copy link
Member

timholy commented Jun 30, 2016

Just from knowing the code that implements this, I'd guess #11242 is to blame---advance apologies. I can take a peek sometime in the next day or so.

@timholy
Copy link
Member

timholy commented Jul 3, 2016

Good evidence that when the type-system rewrite gets underway, a good first step will be to look over our tests and see what's wrong/missing.

@timholy timholy closed this as completed in 44a786a Jul 3, 2016
timholy added a commit that referenced this issue Jul 3, 2016
Type{Tuple{}} should not be a subtype of Type{Tuple}. Fixes #17198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority This should be addressed urgently regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

4 participants