From 93b733cede7d02b5b2437a603186aca269661550 Mon Sep 17 00:00:00 2001 From: Knut Andreas Date: Mon, 10 Nov 2025 16:28:20 +0100 Subject: [PATCH 1/2] Fix infinite recursion causing hang on using float block index --- src/blockindices.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blockindices.jl b/src/blockindices.jl index bc538a06..b1b1fc44 100644 --- a/src/blockindices.jl +++ b/src/blockindices.jl @@ -172,7 +172,7 @@ end @inline BlockIndex(::Tuple{}, b::Tuple{}) = BlockIndex{0,Tuple{},Tuple{}}((), ()) @inline BlockIndex(a::Integer, b) = BlockIndex((a,), (b,)) -@inline BlockIndex(a::Tuple, b) = BlockIndex(a, (b,)) +@inline BlockIndex(a::NTuple{N, Integer}, b) where {N} = BlockIndex(a, (b,)) @inline BlockIndex(a::Integer, b::Tuple) = BlockIndex((a,), b) @inline BlockIndex() = BlockIndex((), ()) From 4c8ad3746d5b8b2d23fb7a47843817604f082153 Mon Sep 17 00:00:00 2001 From: Knut Andreas Date: Mon, 10 Nov 2025 16:31:55 +0100 Subject: [PATCH 2/2] Add test --- test/test_blockindices.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_blockindices.jl b/test/test_blockindices.jl index 02c87dfc..ef60822d 100644 --- a/test/test_blockindices.jl +++ b/test/test_blockindices.jl @@ -113,6 +113,7 @@ import BlockArrays: split_index, merge_indices @test copy(Block(1)[1:2]) === BlockIndexRange(Block(1),1:2) @test copy(Block(1)[[1,3]]) == BlockIndices(Block(1),[1,3]) @test copy(Block(1)[[1,3]]) ≢ BlockIndices(Block(1),[1,3]) + @test_throws MethodError BlockIndex((1.0, 2.0), (1, 2)) end @testset "BlockIndices" begin