Skip to content

Commit b6727d0

Browse files
committed
Fix displaying some UnionAll types
1 parent 2ea3c62 commit b6727d0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

docs/src/_changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Changelog](https://keepachangelog.com).
99

1010
## Unreleased
1111

12+
### Fixed
13+
- Fixed the display of `UnionAll` types such as `Pair.body` ([#1203]).
14+
1215
### Changed
1316
- Replaced JSON.jl with a vendored copy of
1417
[JSONX](https://github.com/JuliaIO/JSON.jl/tree/master/vendor) ([#1200]). This

src/display.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ display_dict(x) = _display_dict(x)
140140

141141
# remove x from the display queue
142142
function undisplay(x, kernel)
143-
i = findfirst(isequal(x), kernel.displayqueue)
143+
# Note that we intentionally create an anonymous function as a comparator
144+
# instead of using the Base.Fix version of `isequal(x)`. This avoids an
145+
# edge-case with Type's: https://github.com/JuliaLang/IJulia.jl/issues/1098
146+
i = findfirst(y -> isequal(x, y), kernel.displayqueue)
144147
i !== nothing && splice!(kernel.displayqueue, i)
145148
return x
146149
end

test/kernel.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ end
332332
@test msg_ok(execute(client, "ans == 42"))
333333
@test kernel.ans
334334

335+
# Test an edge-case with displaying Type's:
336+
# https://github.com/JuliaLang/IJulia.jl/issues/1098
337+
@test msg_ok(execute(client, "Pair.body"))
338+
335339
# Test shutdown_request
336340
@test msg_ok(shutdown(client))
337341
@test timedwait(() -> shutdown_called, 10) == :ok

0 commit comments

Comments
 (0)