Skip to content

Commit ce7ebeb

Browse files
committed
Add a test and correct a typo
1 parent 5dbc334 commit ce7ebeb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

base/broadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ the following rules:
343343
(and treats any `Ref` as a 0-dimensional array of its contents and any tuple
344344
as a 1-dimensional array) expanding singleton dimensions.
345345
346-
The following additional rule apply to `Nullable` arguments:
346+
The following additional rule applies to `Nullable` arguments:
347347
348348
- If there is at least a `Nullable`, and all the arguments are scalars or
349349
`Nullable`, it returns a `Nullable` treating `Nullable`s as "containers".

test/broadcast.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,9 @@ Base.Broadcast.broadcast_c(f, ::Type{Array19745}, A, Bs...) =
409409
@test isa(aa .+ 1, Array19745)
410410
@test isa(aa .* aa', Array19745)
411411
end
412+
413+
# broadcast should only "peel" one container level
414+
let io = IOBuffer()
415+
broadcast(x -> print(io, x), [Nullable(1.0)])
416+
String(take!(io)) == "Nullable{Float64}(1.0)"
417+
end

0 commit comments

Comments
 (0)