Skip to content

Standardize string types in match call#136

Merged
StefanKarpinski merged 1 commit intomasterfrom
teh/match_convert
Mar 17, 2022
Merged

Standardize string types in match call#136
StefanKarpinski merged 1 commit intomasterfrom
teh/match_convert

Conversation

@timholy
Copy link
Copy Markdown
Member

@timholy timholy commented Mar 9, 2022

This will probably fail without the new convert methods in JuliaLang/julia#44500, so wait until that is merged and we're ready to commit to Julia 1.9.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2022

Codecov Report

Merging #136 (7eeb2dc) into master (b7f7418) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #136   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files           4        4           
  Lines         775      775           
=======================================
  Hits          754      754           
  Misses         21       21           
Impacted Files Coverage Δ
src/extract.jl 98.11% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7f7418...7eeb2dc. Read the comment docs.

@KristofferC
Copy link
Copy Markdown
Member

CI still passed but not sure if that just means that this piece of code is untested.

@timholy
Copy link
Copy Markdown
Member Author

timholy commented Mar 12, 2022

I wondered about that too. https://app.codecov.io/gh/JuliaIO/Tar.jl/blob/master/src/extract.jl indicates it's tested. Presumably all AbstractStrings used in the tests are already String or SubString{String}:

julia> struct A end; struct B end;

julia> a = A()
A()

julia> convert(Union{A,B}, a)
A()

So it's only formally needed, to handle cases like

julia> struct C end

julia> Base.convert(::Type{A}, c::C) = A(); Base.convert(::Type{B}, c::C) = B();

julia> convert(Union{A, B}, C())
ERROR: MethodError: Cannot `convert` an object of type 
  C to an object of type 
  Union{A, B}
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:205
Stacktrace:
 [1] top-level scope
   @ REPL[33]:1

@@ -587,7 +587,7 @@ function read_standard_header(
check_checksum_field(buf)
catch err
if err isa ErrorException
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Unrelated to the PR but this should probably not be a standard ErrorException but something more specific.

@timholy
Copy link
Copy Markdown
Member Author

timholy commented Mar 17, 2022

This should be safe to merge now, but no rush either.

@StefanKarpinski StefanKarpinski merged commit 5606269 into master Mar 17, 2022
@StefanKarpinski StefanKarpinski deleted the teh/match_convert branch March 17, 2022 17:22
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