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

Size() ambiguity #8

Closed
ambyld opened this issue Feb 16, 2020 · 2 comments
Closed

Size() ambiguity #8

ambyld opened this issue Feb 16, 2020 · 2 comments

Comments

@ambyld
Copy link

ambyld commented Feb 16, 2020

using StaticArrays, StaticNumbers
x = @SVector ones(3)
1*x

gives

MethodError: Size() is ambiguous. Candidates:
  (::Type{Size})(s::Union{StaticArrays.Dynamic, Int64}...) in StaticArrays at /home/bylard/.julia/packages/StaticArrays/1g9bq/src/traits.jl:66
  (::Type{Size})(s::StaticInteger...) in StaticNumbers at /home/bylard/.julia/packages/StaticNumbers/x5EiE/src/StaticArrays_glue.jl:21
Possible fix, define
  Size()

Interestingly, the following does not give an error:

using StaticArrays
x = @SVector ones(3)
1*x
using StaticNumbers
1*x
3-element SArray{Tuple{3},Float64,1,3} with indices SOneTo(3):
 1.0
 1.0
 1.0

Am I missing something here?

@perrutquist
Copy link
Owner

There was accidental type piracy in the method Size(::StaticInteger...). (In the case of zero arguments, it doesn't depend on the StaticInteger type.)

Thanks for reporting this. It should be fixed now in master.

@ambyld
Copy link
Author

ambyld commented Feb 17, 2020

Thanks for the quick fix!

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