Skip to content

Commit c003514

Browse files
authored
Merge pull request #1203 from JuliaLang/undisplay-type
Fix displaying some `UnionAll` types
2 parents 919ab0c + b6727d0 commit c003514

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
@@ -134,7 +134,10 @@ display_dict(x) = _display_dict(x)
134134

135135
# remove x from the display queue
136136
function undisplay(x, kernel)
137-
i = findfirst(isequal(x), kernel.displayqueue)
137+
# Note that we intentionally create an anonymous function as a comparator
138+
# instead of using the Base.Fix version of `isequal(x)`. This avoids an
139+
# edge-case with Type's: https://github.com/JuliaLang/IJulia.jl/issues/1098
140+
i = findfirst(y -> isequal(x, y), kernel.displayqueue)
138141
i !== nothing && splice!(kernel.displayqueue, i)
139142
return x
140143
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)