Skip to content

Unexpected Union type given constructor #7571

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

Closed
timholy opened this issue Jul 11, 2014 · 3 comments
Closed

Unexpected Union type given constructor #7571

timholy opened this issue Jul 11, 2014 · 3 comments

Comments

@timholy
Copy link
Member

timholy commented Jul 11, 2014

Here's another inference surprise triggered by #7568:

julia> Base.return_types(*, (typeof(AfM), typeof(BfM)))
1-element Array{Any,1}:
 Union(FixedArrayM{Float64,2,SZ},Array{Float64,2})

There's no way that function can return an Array{Float64,2}.

@simonster
Copy link
Member

This is somewhat related to #7569. If type inference can't figure out SZ, then it has to consider the possibility that the generic variant of A_mul_B! could be called rather than the variant you've defined. However, that wouldn't introduce type instability if it weren't for this line:

if mA == 0 || nA == 0 || nB == 0; return zeros(T, mA, nB); end

@Jutho
Copy link
Contributor

Jutho commented Jul 12, 2014

Why is that line like this. Can't one just check C to be of the correct size and then return fill!(C,0).

@simonster
Copy link
Member

@Jutho Yes, I think that's the right thing to do.

sjkelly pushed a commit to sjkelly/julia that referenced this issue Jul 14, 2014
should always mutate, not sometimes return a new array
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

3 participants