File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2
2
3
3
function _join_preserve_annotations (iterator, args... )
4
- if _isannotated (eltype (iterator)) || any (_isannotated, args)
4
+ if isconcretetype (eltype (iterator)) && ! _isannotated (eltype (iterator)) && ! any (_isannotated, args)
5
+ sprint (join, iterator, args... )
6
+ else
5
7
io = AnnotatedIOBuffer ()
6
8
join (io, iterator, args... )
7
- read (seekstart (io), AnnotatedString{String})
8
- else
9
- sprint (join, iterator, args... )
9
+ # If we know (from compile time information, or dynamically in the case
10
+ # of iterators with a non-concrete eltype), that the result is annotated
11
+ # in nature, we extract an `AnnotatedString`, otherwise we just extract
12
+ # a plain `String` from `io`.
13
+ if isconcretetype (eltype (iterator)) || ! isempty (io. annotations)
14
+ read (seekstart (io), AnnotatedString{String})
15
+ else
16
+ String (take! (io. io))
17
+ end
10
18
end
11
19
end
12
20
You can’t perform that action at this time.
0 commit comments