Skip to content

Commit fe976d3

Browse files
authored
Fix map for Julia v0.7 (#296)
* Fix `map` for Julia v0.7 This works around a redefinition of `map` for all `AbstractArray` that occurs on v0.7 but not v0.6. This newly-missed optimization opportunities are probably pretty rare in practice. * Wrong way * Capture more `map`s in v0.7
1 parent d6b882c commit fe976d3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/mapreduce.jl

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66

77
# The following type signature for map() matches any list of AbstractArrays,
88
# provided at least one is a static array.
9-
@inline function map(f, as::Union{SA,AbstractArray}...) where {SA<:StaticArray}
10-
_map(f, same_size(as...), as...)
9+
if VERSION < v"0.7.0-"
10+
@inline function map(f, as::Union{SA,AbstractArray}...) where {SA<:StaticArray}
11+
_map(f, same_size(as...), as...)
12+
end
13+
else
14+
@inline function map(f, a1::StaticArray, as::AbstractArray...)
15+
_map(f, same_size(a1, as...), a1, as...)
16+
end
1117
end
1218

1319
@generated function _map(f, ::Size{S}, a::AbstractArray...) where {S}

0 commit comments

Comments
 (0)