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

julia nightly broke StdWString iteration #391

Open
benlorenz opened this issue Oct 30, 2023 · 1 comment
Open

julia nightly broke StdWString iteration #391

benlorenz opened this issue Oct 30, 2023 · 1 comment

Comments

@benlorenz
Copy link
Contributor

While trying to adapt libcxxwrap and cxxwrap to julia nightly, in addition to #390 and JuliaInterop/libcxxwrap-julia#137 I got several errors from the new StdString code from #381:

iterate: Error During Test at /home/lorenz/software/polymake/julia/CxxWrap.jl/test/stdlib.jl:130
  Test threw exception
  Expression: iterate(s) == (char, 2)
  MethodError: no method matching between(::UInt32, ::UInt8, ::UInt8)
  
  Closest candidates are:
    between(::T, ::T, ::T) where T<:Integer
     @ Base strings/string.jl:32
  
  Stacktrace:
   [1] _nextind_str
     @ ./strings/string.jl:182 [inlined]
   [2] nextind
     @ ~/software/polymake/julia/CxxWrap.jl/src/StdLib.jl:41 [inlined]
   [3] iterate(s::CxxWrap.StdLib.StdWStringAllocated, i::Int64)
     @ CxxWrap.StdLib ~/software/polymake/julia/CxxWrap.jl/src/StdLib.jl:45
   [4] iterate
     @ ~/software/polymake/julia/CxxWrap.jl/src/StdLib.jl:44 [inlined]
   [5] macro expansion
     @ ~/software/polymake/julia/julia/julia-nightly/share/julia/stdlib/v1.11/Test/src/Test.jl:519 [inlined]
   [6] macro expansion
     @ ~/software/polymake/julia/CxxWrap.jl/test/stdlib.jl:54 [inlined]
   [7] macro expansion
     @ ~/software/polymake/julia/julia/julia-nightly/share/julia/stdlib/v1.11/Test/src/Test.jl:1598 [inlined]
   [8] top-level scope
     @ ~/software/polymake/julia/CxxWrap.jl/test/stdlib.jl:10

The code in question is calling the internal Base._nextind_str:

Base.nextind(s::CppBasicString, i::Int) = Base._nextind_str(s, i)

But after the recent optimizations in JuliaLang/julia#51671 this stopped working when passing in UInt32 codepoints.

cc: @omus

@barche
Copy link
Collaborator

barche commented Nov 1, 2023

Adding a method to Base.between fixes this (PR #392), not sure if that is a good idea though.

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

No branches or pull requests

2 participants