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 inference for constructor with tuple-of-Int parameter #7569

Closed
timholy opened this issue Jul 11, 2014 · 1 comment
Closed

Type inference for constructor with tuple-of-Int parameter #7569

timholy opened this issue Jul 11, 2014 · 1 comment

Comments

@timholy
Copy link
Sponsor Member

timholy commented Jul 11, 2014

julia> immutable MyType{SZ}
           data::Int
       end

julia> mt = MyType{(3,5)}(1)
MyType{(3,5)}(1)

julia> doubleall(mt::MyType{(3,5)}) = MyType{(6,10)}(2*mt.data)
doubleall (generic function with 1 method)

julia> typeof(doubleall(mt))
MyType{(6,10)} (constructor with 1 method)

julia> Base.return_types(doubleall, (typeof(mt),))
1-element Array{Any,1}:
 MyType{SZ}

The SZ is the surprising part; why isn't it MyType{(6,10)}?

This is relevant for the more interesting example in #7568, where

julia> Base.return_types(*, (typeof(AfI), typeof(BfI)))
1-element Array{Any,1}:
 FixedArrayI{Float64,2,SZ,6}
@JeffBezanson
Copy link
Sponsor Member

dup of #7060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants