Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ Currently, the `@compat` macro supports the following syntaxes:

* `OS_NAME` is now `Sys.KERNEL`. OS information available as `is_apple`, `is_bsd`, `is_linux`, `is_unix`, and `is_windows`. [16219](https://github.com/JuliaLang/julia/pull/16219)

* `Base.Broadcast.broadcast_shape` now returns a tuple containing a `Base.OneTo` object rather than integers.
Compat provides an unexported `Compat.broadcast_shape` that mimics the behavior from 0.4.
[#17137](https://github.com/JuliaLang/julia/pull/17137)

## New types

* [`Nullable` types](http://julia.readthedocs.org/en/latest/manual/types/?highlight=nullable#nullable-types-representing-missing-values) and their associated operations.
Expand Down
6 changes: 6 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1316,4 +1316,10 @@ if !isdefined(Base, :allunique)
export allunique
end

if isdefined(Base, :OneTo) && isdefined(Base, :to_shape)
broadcast_shape(x...) = Base.to_shape(Base.Broadcast.broadcast_shape(x...))
else
const broadcast_shape = Base.Broadcast.broadcast_shape
end

end # module
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1256,3 +1256,8 @@ end
let a = rand(10,10)
@test view(a, :, 1) == a[:,1]
end

@test Compat.broadcast_shape([1 2; 3 4], [1,1]) == (2,2)
@test Compat.broadcast_shape([1,2,3], 4) == (3,)
@test Compat.broadcast_shape() == ()
@test Compat.broadcast_shape(4.3) == ()