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

Remove some converters #213

Merged
merged 9 commits into from
Mar 14, 2023
Merged

Remove some converters #213

merged 9 commits into from
Mar 14, 2023

Conversation

putianyi889
Copy link
Contributor

This is because Julia lowers some conversion to construction. A few constructors are added.

# abstractarray.jl
convert(::Type{T}, a::T) where {T<:AbstractArray} = a
convert(::Type{AbstractArray{T}}, a::AbstractArray) where {T} = AbstractArray{T}(a)
convert(::Type{AbstractArray{T,N}}, a::AbstractArray{<:Any,N}) where {T,N} = AbstractArray{T,N}(a)

@putianyi889 putianyi889 changed the title Remove converters Remove some converters Mar 9, 2023
@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

Merging #213 (c62df63) into master (f9f94c1) will increase coverage by 0.80%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #213      +/-   ##
==========================================
+ Coverage   97.92%   98.73%   +0.80%     
==========================================
  Files           4        4              
  Lines         676      633      -43     
==========================================
- Hits          662      625      -37     
+ Misses         14        8       -6     
Impacted Files Coverage Δ
src/FillArrays.jl 99.07% <100.00%> (+1.62%) ⬆️
src/fillalgebra.jl 98.88% <100.00%> (-0.07%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dlfivefifty
Copy link
Member

Can you increase the coverage by adding tests?

@putianyi889
Copy link
Contributor Author

putianyi889 commented Mar 10, 2023

Can you increase the coverage by adding tests?

will do on later PRs

@putianyi889 putianyi889 mentioned this pull request Mar 11, 2023
@dlfivefifty dlfivefifty merged commit 5ee8beb into JuliaArrays:master Mar 14, 2023
@jishnub
Copy link
Member

jishnub commented Mar 14, 2023

I think the type-piracy should be fixed, as it's quite egregious as it stands at the moment.

dlfivefifty added a commit that referenced this pull request Mar 14, 2023
@dlfivefifty
Copy link
Member

@putianyi889 I had to revert this commit as you are committing type-piracy. E.g.:

# temporary patch. should be a PR(#48895) to LinearAlgebra
 Diagonal{T}(A::AbstractMatrix) where T = Diagonal{T}(diag(A))
 function convert(::Type{T}, A::AbstractMatrix) where T<:Diagonal 
     checksquare(A)
     isdiag(A) ? T(A) : throw(InexactError(:convert, T, A))
 end

which does not relate to types in this package. Can you please fix these overloads and resubmit the PR?

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.

3 participants