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

No constructor for fully specified type #17

Closed
Wizarth opened this issue May 26, 2022 · 1 comment
Closed

No constructor for fully specified type #17

Wizarth opened this issue May 26, 2022 · 1 comment

Comments

@Wizarth
Copy link

Wizarth commented May 26, 2022

These all produce the same type: CircularArray{Float64, 2, Matrix{Float64}}

  • CircularArray( zeros(2, 2) )
  • CircularArray{Float64}( zeros(2, 2) )
  • CircularArray{Float64, 2}( zeros(2, 2) )

However, CircularArray{Float64, 2, Matrix{Float64}}( zeros(2, 2) ) fails with MethodError: no method matching CircularArray{Float64, 2, Matrix{Float64}}(::Matrix{Float64})

This is a problem when creating a function that takes an AbstractArray, produces a new Vector that gets reshaped to the same size as the AbstractArray, then tries to return the same type as the original AbstractArray using convert, or by trying to call the constructor using typeofor by the function being parametric.

I think the missing constructor can be addressed by adding a constructor that is parametric on all three types? I don't know if it makes sense to have convert work in this context.

@Vexatos
Copy link
Owner

Vexatos commented May 27, 2022

It was indeed just missing another constructor. Thanks for the report.

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