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

SVector(0.0,0) throws an error #120

Closed
dlfivefifty opened this issue Mar 20, 2017 · 5 comments
Closed

SVector(0.0,0) throws an error #120

dlfivefifty opened this issue Mar 20, 2017 · 5 comments

Comments

@dlfivefifty
Copy link
Member

I would expect this to promote to Float64:

julia> SVector(0.,0)
ERROR: The size of type `StaticArrays.SVector` is not known.

If you were trying to construct (or `convert` to) a `StaticArray` you
may need to add the size explicitly as a type parameter so its size is
inferrable to the Julia compiler (or performance would be terrible). For
example, you might try

    m = zeros(3,3)
    SMatrix(m)      # this error
    SMatrix{3,3}(m) # correct - size is inferrable

Stacktrace:
 [1] StaticArrays.Size(::Type{StaticArrays.SVector}) at /Users/solver/.julia/v0.6/StaticArrays/src/traits.jl:42
 [2] StaticArrays.SVector(::Float64, ::Int64) at /Users/solver/.julia/v0.6/StaticArrays/src/core.jl:37
@dlfivefifty
Copy link
Member Author

This is only in 0.6

@andyferris
Copy link
Member

Can you try Pkg.checkout("StaticArrays", "julia-0.6") on v0.6, and see if the problem is gone?

(I haven't quite finished that branch, but it should have most basic functionality working)

@dlfivefifty
Copy link
Member Author

julia> Pkg.checkout("StaticArrays","julia-0.6")
INFO: Checking out StaticArrays julia-0.6...
INFO: Pulling StaticArrays latest julia-0.6...
WARNING: Cannot perform fast-forward merge.
INFO: No packages to install, update or remove

julia> using StaticArrays

julia> SVector(1.0,1)
ERROR: No precise constructor for StaticArrays.SVector found. Length of input was 2.
Stacktrace:
 [1] StaticArrays.SVector(::Float64, ::Int64) at /Users/solver/.julia/v0.6/StaticArrays/src/convert.jl:3

@dlfivefifty
Copy link
Member Author

So the error is slightly different

@andyferris
Copy link
Member

There was a missing Any in NTuple{N, Any} in one of the SVector constructors. In v0.6 this is distinct from NTuple{N} which asserts that the types are the same via NTuple{N, T} where T (with T concrete in covariant positions in a UnionAll). I'm fixing this on the julia-0.6 branch, so I'll close the issue.

Thanks for reporting.

oschulz pushed a commit to oschulz/StaticArrays.jl that referenced this issue Apr 4, 2023
* remove generated in roweq

* avoid unnecessary Base

* remove generated function on rowcmp
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