-
Notifications
You must be signed in to change notification settings - Fork 34
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
Overload ncodeunits on 0.7 #114
Conversation
Probably worth retagging 0.3.3 after merging this. |
The string stuff in this package is still woefully broken after JuliaLang/julia#24999. |
The stack overflow happens when filling the array to return: using Unicode
pool = CategoricalPool(["", "caf"])
v2 = CategoricalArrays.catvalue(2, pool)
g = graphemes(v2)
x = Base._similar_for(1:1, eltype(g), g, Base.iteratorsize(g))
x[1] = first(g) So the problem happens when trying to convert a convert(SubString{CategoricalString{UInt32}}, first(g)) That's really weird since we're supposed to have no-op |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, I completely forgot this. I think we also need tests for ncodeunits
.
test/08_string.jl
Outdated
@test_throws BoundsError ind2chr(v1, 0) | ||
@test ind2chr(v2, 4) === 4 | ||
if VERSION < v"0.7.0-DEV.2949" | ||
@test_throws BoundsError ind2chr(v1, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be converted to length
calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there Compat for multi-arg length
?
test/08_string.jl
Outdated
@test collect(graphemes(v2)) == collect(graphemes("café")) | ||
if VERSION < v"0.7.0-DEV.2949" | ||
# FIXME: This causes a StackOverflowError after the string overhaul | ||
@test collect(graphemes(v2)) == collect(graphemes("café")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather keep this or mark it as @test_broken
, else we'll forget about it.
src/value.jl
Outdated
Base.nextind(x::CategoricalString, i::Integer) = nextind(get(x), i) | ||
Base.prevind(x::CategoricalString, i::Integer) = prevind(get(x), i) | ||
Base.nextind(x::CategoricalString, i::Integer) = nextind(x, Int(i)) | ||
Base.nextind(x::CategoricalString, i::Int) = nextind(get(x), i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to define a method for ::Int
, the conversion used in the ::Integer
method will be a no-op anyway.
If you know what needs to change here, do feel free to push directly to this branch, @nalimilan. Otherwise I'll see if I can get to this a little later. |
209f11f
to
f9da21b
Compare
I've added more changes to fix all errors and deprecations in 08_string.jl. I've stopped using "é" in the tests since it triggers failures in Base which should be handled separately. |
No description provided.