Skip to content

Commit 56ffd45

Browse files
authored
added IO to broadcastable (#42070)
1 parent 72d1f23 commit 56ffd45

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
@@ -697,7 +697,7 @@ julia> Broadcast.broadcastable("hello") # Strings break convention of matching i
697697
Base.RefValue{String}("hello")
698698
```
699699
"""
700-
broadcastable(x::Union{Symbol,AbstractString,Function,UndefInitializer,Nothing,RoundingMode,Missing,Val,Ptr,AbstractPattern,Pair}) = Ref(x)
700+
broadcastable(x::Union{Symbol,AbstractString,Function,UndefInitializer,Nothing,RoundingMode,Missing,Val,Ptr,AbstractPattern,Pair,IO}) = Ref(x)
701701
broadcastable(::Type{T}) where {T} = Ref{Type{T}}(T)
702702
broadcastable(x::Union{AbstractArray,Number,AbstractChar,Ref,Tuple,Broadcasted}) = x
703703
# Default to collecting iterables — which will error for non-iterables

test/broadcast.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,3 +1052,9 @@ end
10521052
@test Broadcast.BroadcastFunction(+)(2:3, 2:3) == 4:2:6
10531053
@test Broadcast.BroadcastFunction(+)(2:3, 2:3) isa AbstractRange
10541054
end
1055+
1056+
@testset "#42063" begin
1057+
buf = IOBuffer()
1058+
@test println.(buf, [1,2,3]) == [nothing, nothing, nothing]
1059+
@test String(take!(buf)) == "1\n2\n3\n"
1060+
end

0 commit comments

Comments
 (0)