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

Fixed method ambiguities for Base.unsafe_convert(), Base.lstrip, and Base.rstrip #70

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

brainandforce
Copy link
Contributor

@brainandforce brainandforce commented Oct 19, 2023

This doesn't fully solve #64, but it does solve two ambiguities: those between InlineStrings

unsafe_convert(::Type{Ptr{Int8}}}, x::Ref{T}) where T<:InlineString
unsafe_convert(::Type{Ptr{UInt8}}}, x::Ref{T}) where T<:InlineString

and Julia Base

unsafe_convert(::Type{P}, x::Ptr) where P<:Ptr

@bkamins
Copy link

bkamins commented Oct 20, 2023

could we add tests for these new methods?

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (bca08b0) 92.95% compared to head (7b26d49) 92.73%.

Files Patch % Lines
src/InlineStrings.jl 71.42% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
- Coverage   92.95%   92.73%   -0.22%     
==========================================
  Files           2        2              
  Lines         681      688       +7     
==========================================
+ Hits          633      638       +5     
- Misses         48       50       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brainandforce
Copy link
Contributor Author

brainandforce commented Nov 15, 2023

I've added some fixes and tests for new ambiguities I've discovered with Base.lstrip and Base.rstrip. However, I wasn't sure if it was meaningful to test methods containing a Ptr{<:InlineString} argument, the reason being that immutable objects do not have stable memory addresses.

In practice nobody should ever be constructing a Ptr{<:InlineString}. The method definition only exists to resolve the ambiguity.

@brainandforce brainandforce changed the title Fixed method ambiguities for Base.unsafe_convert() Fixed method ambiguities for Base.unsafe_convert(), Base.lstrip, and Base.rstrip Nov 16, 2023
@mortenpi
Copy link

Could this be merged and tagged?

@quinnj quinnj merged commit 38607a6 into JuliaStrings:main Jun 17, 2024
6 checks passed
mortenpi added a commit to JuliaComputing/JuliaHub.jl that referenced this pull request Jun 18, 2024
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.

None yet

5 participants