Skip to content

Commit

Permalink
fix #16089
Browse files Browse the repository at this point in the history
Forming the type of a vararg tuple needed to call `tuple_tfunc`.

Some code in linalg/qr depended on inferring varargs with Type{}.
Fortunately the number of arguments was 0 or 1, so add a quick workaround.
  • Loading branch information
JeffBezanson committed Apr 28, 2016
1 parent ade5a90 commit b0c54f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type InferenceState
end
s[1][la] = VarState(Tuple,false)
else
s[1][la] = VarState(limit_tuple_depth(tupletype_tail(atypes,la)),false)
s[1][la] = VarState(tuple_tfunc(limit_tuple_depth(tupletype_tail(atypes,la))),false)
end
la -= 1
end
Expand Down
6 changes: 4 additions & 2 deletions base/linalg/qr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ end
qrfact!{T<:BlasFloat}(A::StridedMatrix{T}, ::Type{Val{false}}) = QRCompactWY(LAPACK.geqrt!(A, min(minimum(size(A)), 36))...)
qrfact!{T<:BlasFloat}(A::StridedMatrix{T}, ::Type{Val{true}}) = QRPivoted(LAPACK.geqp3!(A)...)
qrfact!{T<:BlasFloat}(A::StridedMatrix{T}) = qrfact!(A, Val{false})
qrfact{T<:BlasFloat}(A::StridedMatrix{T}, args...) = qrfact!(copy(A), args...)
qrfact{T<:BlasFloat}(A::StridedMatrix{T}, arg) = qrfact!(copy(A), arg)
qrfact{T<:BlasFloat}(A::StridedMatrix{T}) = qrfact!(copy(A))

# Generic fallbacks
qrfact!(A::StridedMatrix, ::Type{Val{false}}) = qrfactUnblocked!(A)
qrfact!(A::StridedMatrix, ::Type{Val{true}}) = qrfactPivotedUnblocked!(A)
qrfact!(A::StridedMatrix) = qrfact!(A, Val{false})
qrfact{T}(A::StridedMatrix{T}, args...) = qrfact!(copy_oftype(A, typeof(zero(T)/norm(one(T)))), args...)
qrfact{T}(A::StridedMatrix{T}, arg) = qrfact!(copy_oftype(A, typeof(zero(T)/norm(one(T)))), arg)
qrfact{T}(A::StridedMatrix{T}) = qrfact!(copy_oftype(A, typeof(zero(T)/norm(one(T)))))
qrfact(x::Number) = qrfact(fill(x,1,1))

qr(A::Union{Number, AbstractMatrix}, pivot::Union{Type{Val{false}}, Type{Val{true}}}=Val{false}; thin::Bool=true) =
Expand Down
5 changes: 5 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3848,3 +3848,8 @@ test_metadata_matches(f3, Tuple{})
test_metadata_matches(f4, Tuple{})

end

# issue #16089
f16089(args...) = typeof(args)
g16089() = f16089(UInt8)
@test g16089() === Tuple{DataType}

0 comments on commit b0c54f0

Please sign in to comment.