-
Notifications
You must be signed in to change notification settings - Fork 150
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
Error returning eltype of SMatrix #423
Comments
I can't reproduce with Julia 0.6.2 (or master) and StaticArrays master: julia> using StaticArrays.FixedSizeArrays
julia> eltype(Mat{3,3,Int, 9}) # Int64
Int64
julia> eltype(Mat{3,3,Int}) # TypeError: UnionAll: expected Type, got Int64
Int64
julia> eltype(Mat{3,Int}) # TypeError: UnionAll: expected Type, got Int64
Any
julia> eltype(Mat{Int}) # Any
Any
julia> eltype(Mat{3}) # TypeError: UnionAll: expected Type, got Int64
Any |
I'm using Julia 0.6.3 on ArchLinux. With a fresh start of julia (without loading any module), I get:
I don't remember which modules were loaded last time, so I cannot reproduce. I still cannot load GLAbstraction.js though. |
On 0.6.3 with StaticArrays master I can now reproduce the behavior in #423 (comment). I guess a better error message would be nice, but Julia currently has no way of expressing the constraint that a type parameter should be an integer value (e.g. By the way, the method in the issue description is technically type piracy. But in general, if you want to be able to write function Mat{3}(q::Quaternions.Quaternion{T}) where {T}
sx, sy, sz = 2q.s*q.v1, 2q.s*q.v2, 2q.s*q.v3
xx, xy, xz = 2q.v1^2, 2q.v1*q.v2, 2q.v1*q.v3
yy, yz, zz = 2q.v2^2, 2q.v2*q.v3, 2q.v3^2
T0, T1 = zero(T), one(T)
Mat{3}(
T1-(yy+zz), xy+sz, xz-sy,
xy-sz, T1-(xx+zz), yz+sx,
xz+sy, yz-sx, T1-(xx+yy)
)
end Also note that Rotations.jl exists, is built on top of |
Probably fixed by JuliaLang/julia#27404. |
Ok, thanks a lot! I will report to the GLAbstraction.jl package maintainer. |
This has long since been sorted out elsewhere I think. |
Testing package
GLVisualize.jl
, I got an error inGLAbstarction.jl
(https://github.com/JuliaGL/GLAbstraction.jl/blob/master/src/GLMatrixMath.jl). The error is:LoadError: TypeError: UnionAll: expected Type, got Int64
It points to this function in
GLMatrixMath.jl
:I figured out that checking the element type of some SMatrix gives me the same error:
Is it related to the error in
GLAbstarction.jl
?The text was updated successfully, but these errors were encountered: