From 2d64194453344bbd7a6aca0a44770006338c629f Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Tue, 31 Oct 2023 12:18:31 +0100 Subject: [PATCH] Bugfix. --- src/host/indexing.jl | 2 +- test/testsuite/indexing.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/host/indexing.jl b/src/host/indexing.jl index 346c2a01..069bdc30 100644 --- a/src/host/indexing.jl +++ b/src/host/indexing.jl @@ -154,7 +154,7 @@ function gpu_checkindex_indices(A, IA::Tuple, I::Tuple) end function gpu_checkindex_indices(A, ::Tuple{}, I::Tuple) @inline - gpu_checkindex(A, OneTo(1), I[1])::Bool & gpu_checkindex_indices(A, (), tail(I)) + gpu_checkindex(A, Base.OneTo(1), I[1])::Bool & gpu_checkindex_indices(A, (), tail(I)) end gpu_checkindex_indices(A, IA::Tuple, ::Tuple{}) = (@inline; all(x->length(x)==1, IA)) gpu_checkindex_indices(A, ::Tuple{}, ::Tuple{}) = true diff --git a/test/testsuite/indexing.jl b/test/testsuite/indexing.jl index 7aa29758..f5a1a1eb 100644 --- a/test/testsuite/indexing.jl +++ b/test/testsuite/indexing.jl @@ -129,6 +129,12 @@ end @test_throws DimensionMismatch x[1:9,1:9,:,:] = y end + @testset "mismatching axes/indices" begin + a = rand(1,1) + @test compare(a->a[1:1], AT, a) + @test compare(a->a[1:1,1:1], AT, a) + @test compare(a->a[1:1,1:1,1:1], AT, a) + end end @testsuite "indexing find" (AT, eltypes)->begin