Skip to content

Commit 61f8891

Browse files
authored
A couple of inferrability improvements (#968)
These silence some long warnings when inspecting a CSV-dependent package with JET.
1 parent df718c7 commit 61f8891

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/file.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,8 @@ function checkpooled!(::Type{T}, pertaskcolumns, col, j, ntasks, nrows, ctx) whe
522522
end
523523
end
524524
end
525-
percent = col.pool isa Tuple ? col.pool[1] : col.pool
525+
cpool = col.pool
526+
percent = cpool isa Tuple ? cpool[1] : cpool
526527
if ((length(pool) - 1) / nrows) <= percent
527528
col.column = PooledArray(PooledArrays.RefArray(refs), pool)
528529
return true
@@ -767,12 +768,13 @@ function parsevalue!(::Type{type}, buf, pos, len, row, rowoffset, i, col, ctx)::
767768
col.anymissing = true
768769
else
769770
column = col.column
770-
if column isa Vector{PosLen}
771-
@inbounds (column::Vector{PosLen})[row] = res.val
771+
val = res.val
772+
if column isa Vector{PosLen} && val isa PosLen
773+
@inbounds (column::Vector{PosLen})[row] = val
772774
elseif type === String
773-
@inbounds (column::SVec2{String})[row] = Parsers.getstring(buf, res.val, opts.e)
775+
@inbounds (column::SVec2{String})[row] = Parsers.getstring(buf, val, opts.e)
774776
else
775-
@inbounds (column::vectype(type))[row] = res.val
777+
@inbounds (column::vectype(type))[row] = val
776778
end
777779
end
778780
end

0 commit comments

Comments
 (0)