Skip to content

julia nightly broke StdWString iteration #391

Open
@benlorenz

Description

@benlorenz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions