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

Fix startswith/endswith for Julia 1.10 #68

Merged
merged 3 commits into from
Jul 29, 2023
Merged

Fix startswith/endswith for Julia 1.10 #68

merged 3 commits into from
Jul 29, 2023

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Jul 29, 2023

We were relying on the Base implementation of _memcmp, but it changed in 1.10 and isn't compatible with InlineStrings, so we can just dispatch to the (slightly slower) AbstractString fallback to not be broken on 1.10 for now.

JuliaLang/julia@f8dd16e#r118957569

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2023

Codecov Report

Merging #68 (c88c980) into main (85fc0d1) will decrease coverage by 0.13%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
- Coverage   93.07%   92.95%   -0.13%     
==========================================
  Files           2        2              
  Lines         679      681       +2     
==========================================
+ Hits          632      633       +1     
- Misses         47       48       +1     
Files Changed Coverage Δ
src/InlineStrings.jl 92.92% <100.00%> (-0.13%) ⬇️

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

@@ -693,6 +695,8 @@ function Base.startswith(a::T, b::Union{String, SubString{String}, InlineString}
end
end

#TODO: optimize this
Base.endswith(a::InlineString, b::InlineString) = invoke(endswith, Tuple{AbstractString, AbstractString}, a, b)
function Base.endswith(a::T, b::Union{String, SubString{String}, InlineString}) where {T <: InlineString}
Copy link

Choose a reason for hiding this comment

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

you left InlineString in the signature here (but you dropped it in line 684).

BTW: why invoking generic function if both strings are InlineString is required?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good catch. We were relying on the Base implementation of _memcmp, but it changed in 1.10 and isn't compatible with InlineStrings, so we can just dispatch to the (slightly slower) AbstractString fallback to not be broken on 1.10 for now.

@quinnj quinnj merged commit dafec6f into main Jul 29, 2023
6 checks passed
@quinnj quinnj deleted the jq-fix-nightly branch July 29, 2023 13:06
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