From 01fc2b9fe3da32f90ca9606c061cbae87c5a23a0 Mon Sep 17 00:00:00 2001 From: Cody Tapscott Date: Thu, 23 Apr 2026 12:38:21 -0400 Subject: [PATCH] Fix `eltype` for `FatMachOHandle` --- src/MachO/MachOFat.jl | 2 +- test/runtests.jl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MachO/MachOFat.jl b/src/MachO/MachOFat.jl index b636f21..68efcf9 100644 --- a/src/MachO/MachOFat.jl +++ b/src/MachO/MachOFat.jl @@ -67,7 +67,7 @@ keys(h::FatMachOHandle) = 1:length(h) iterate(h::FatMachOHandle, idx=1) = idx > length(h) ? nothing : (h[idx], idx+1) lastindex(h::FatMachOHandle) = lastindex(h.header.archs) length(h::FatMachOHandle) = length(h.header.archs) -eltype(::Type{S}) where {S <: FatMachOHandle} = MachOLoadCmdRef +eltype(::Type{<:FatMachOHandle}) = MachOHandle function getindex(h::FatMachOHandle, idx) seek(h.io, h.start + h.header.archs[idx].offset) only(readmeta(h.io, MachOHandle)) diff --git a/test/runtests.jl b/test/runtests.jl index ba88082..d67c56e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -204,6 +204,10 @@ function test_fat_libfoo(file) end @test ntotal == 2 @test n64 == 1 + + handles = collect(ohs) + @test handles isa Vector{<:MachOHandle} + @test length(handles) == 2 end function test_metal(file)