-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
The following code does not work on my Windows PC (tested on 3 different machines running Julia v1.8.0-rc3 and v1.8.0). Seems to work though on Linux. To test, make sure to run with --check-bounds=yes...
using Revise, Pkg, Test
Pkg.activate(; temp=true)
Pkg.add(name="NearestNeighbors", version="0.4.10")
using NearestNeighbors
data = [[0.13380863416387367, 0.7845254987714512],[0.1563342025559629, 0.],[0.563342025559629, 0.7]]
tree = KDTree(hcat(map(p -> [p[1], p[2]], data)...));
println(":: current path ==> $(which(knn, typeof.((tree, [0.15, 0.8], 3, true, x -> x == 2))).file)")
@test_throws BoundsError knn(tree, [0.15, 0.8], 3, true, x -> x == 2) # buggy behavior
Pkg.update("NearestNeighbors")
revise(NearestNeighbors)
println(":: updated path ==> $(which(knn, typeof.((tree, [0.15, 0.8], 3, true, x -> x == 2))).file)")
nearest, distance = knn(tree, [0.15, 0.8], 3, true, x -> x == 2) # should work, but fails on WindowsWith the following output...
> julia --check-bounds=yes -q -i test2.jl
Activating new project at `C:\Users\CarmanBr\AppData\Local\Temp\jl_UgBJAS`
Updating registry at `C:\Users\CarmanBr\.julia\registries\CatapultApps`
Updating git-repo `https://ist-catapult.visualstudio.com/DefaultCollection/CatapultApps/_git/Registry`
Updating registry at `C:\Users\CarmanBr\.julia\registries\General.toml`
Resolving package versions...
Updating `C:\Users\CarmanBr\AppData\Local\Temp\jl_UgBJAS\Project.toml`
⌃ [b8a86587] + NearestNeighbors v0.4.10
Updating `C:\Users\CarmanBr\AppData\Local\Temp\jl_UgBJAS\Manifest.toml`
[b4f34e82] + Distances v0.10.7
⌃ [b8a86587] + NearestNeighbors v0.4.10
[90137ffa] + StaticArrays v1.5.6
[1e83bf80] + StaticArraysCore v1.3.0
[82ae8749] + StatsAPI v1.5.0
[56f22d72] + Artifacts
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[9a3f8284] + Random
[ea8e919c] + SHA v0.7.0
[9e88b42a] + Serialization
[2f01184e] + SparseArrays
[10745b16] + Statistics
[e66e0078] + CompilerSupportLibraries_jll v0.5.2+0
[4536629a] + OpenBLAS_jll v0.3.20+0
[8e850b90] + libblastrampoline_jll v5.1.1+0
Info Packages marked with ⌃ have new versions available
:: current path ==> C:\Users\CarmanBr\.julia\packages\NearestNeighbors\YCcEC\src\knn.jl
Updating registry at `C:\Users\CarmanBr\.julia\registries\CatapultApps`
Updating git-repo `https://ist-catapult.visualstudio.com/DefaultCollection/CatapultApps/_git/Registry`
Updating registry at `C:\Users\CarmanBr\.julia\registries\General.toml`
Updating `C:\Users\CarmanBr\AppData\Local\Temp\jl_UgBJAS\Project.toml`
[b8a86587] ↑ NearestNeighbors v0.4.10 ⇒ v0.4.11
Updating `C:\Users\CarmanBr\AppData\Local\Temp\jl_UgBJAS\Manifest.toml`
[b8a86587] ↑ NearestNeighbors v0.4.10 ⇒ v0.4.11
:: updated path ==> C:\Users\CarmanBr\.julia\packages\NearestNeighbors\YCcEC\src\knn.jl
ERROR: LoadError: BoundsError: attempt to access 3-element Vector{Int64} at index [-1]
Stacktrace:
[1] getindex
@ .\array.jl:924 [inlined]
[2] knn_point!(tree::KDTree{StaticArraysCore.SVector{2, Float64}, Euclidean, Float64}, point::Vector{Float64}, sortres::Bool, dist::Vector{Float64}, idx::Vector{Int64}, skip::var"#9#10")
@ NearestNeighbors C:\Users\CarmanBr\.julia\packages\NearestNeighbors\YCcEC\src\knn.jl:36
[3] knn(tree::KDTree{StaticArraysCore.SVector{2, Float64}, Euclidean, Float64}, point::Vector{Float64}, k::Int64, sortres::Bool, skip::var"#9#10")
@ NearestNeighbors C:\Users\CarmanBr\.julia\packages\NearestNeighbors\YCcEC\src\knn.jl:46
[4] top-level scope
@ C:\Work\IST\Projects\JuliaPackages\BuildAndBenchmark.jl\test2.jl:16
As can be seen, the "current" and "updated" paths are the same. Revise is not updating to the new code path.
Metadata
Metadata
Assignees
Labels
No labels