Skip to content

Conversation

c42f
Copy link
Member

@c42f c42f commented Aug 23, 2019

Fixes #651

@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 81.694% when pulling d3ef4c9 on cjf/fix-empty-constructor into 3b137f7 on master.

@c42f c42f merged commit 712c12f into master Aug 23, 2019
@c42f c42f deleted the cjf/fix-empty-constructor branch August 24, 2019 01:59

@inline _convert(SA, a, ::Length{L}) where L = SA(unroll_tuple(a, Length(SA)))
@inline _convert(SA, a, l::Length) = SA(unroll_tuple(a, l))
@inline _convert(SA::Type{<:StaticArray{<:Tuple,T}}, a, ::Length{0}) where T = similar_type(SA, T)(())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect a type assertion would be good here (that the output is indeeed an SA).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do that. Which error condition are you trying to cover, is it protection for the user to avoid stack overflows when they have a broken similar_type (constructor calling _convert calling constructor etc) or some such?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just guarding against the case that similar_type(SA) isn’t an SA (like rotations) which means constructors and conversion might return a rather surprising result.

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

Successfully merging this pull request may close these issues.

Type Stability of Constructor

3 participants