Skip to content

Commit 42f5f9d

Browse files
committed
Use UInt for offset in highlight context
Julia CI indicates that on 32-bit machines, a method error occurs when HighightContext is attempted to be constructed using a UInt32 when only an Int32 is allowed. Since the only thing that happens with the offset is addition, and unsigned integers "win" in addition (i.e. the result is unsigned) I suspect that unsigned-ness spreads from our use of JuliaSyntax. If this is indeed the case, then simply switching the offset from an Int to UInt will resolve this issue.
1 parent 0123b35 commit 42f5f9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/JuliaSyntaxHighlighting.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ end
148148

149149
struct HighlightContext{S <: AbstractString}
150150
content::S
151-
offset::Int
151+
offset::UInt
152152
lnode::GreenNode
153153
pdepths::ParenDepthCounter
154154
end
@@ -165,7 +165,7 @@ This is a small wrapper around [`_hl_annotations!`](@ref) for convenience.
165165
"""
166166
function _hl_annotations(content::AbstractString, ast::GreenNode)
167167
highlights = Vector{Tuple{UnitRange{Int}, Pair{Symbol, Any}}}()
168-
ctx = HighlightContext(content, 0, ast, ParenDepthCounter())
168+
ctx = HighlightContext(content, zero(UInt), ast, ParenDepthCounter())
169169
_hl_annotations!(highlights, GreenLineage(ast, nothing), ctx)
170170
highlights
171171
end

0 commit comments

Comments
 (0)