@@ -43,8 +43,8 @@ julia> showable("img/png", rand(5))
43
43
false
44
44
```
45
45
"""
46
- showable (:: MIME{mime} , x) where {mime} = hasmethod (show, Tuple{IO, MIME{mime}, typeof (x)})
47
- showable (m:: AbstractString , x) = showable (MIME (m), x)
46
+ showable (:: MIME{mime} , @nospecialize x) where {mime} = hasmethod (show, Tuple{IO, MIME{mime}, typeof (x)})
47
+ showable (m:: AbstractString , @nospecialize x) = showable (MIME (m), x)
48
48
49
49
"""
50
50
show(io, mime, x)
175
175
abstract type AbstractDisplay end
176
176
177
177
# it is convenient to accept strings instead of ::MIME
178
- display (d:: AbstractDisplay , mime:: AbstractString , x) = display (d, MIME (mime), x)
179
- display (mime:: AbstractString , x) = display (MIME (mime), x)
178
+ display (d:: AbstractDisplay , mime:: AbstractString , @nospecialize x) = display (d, MIME (mime), x)
179
+ display (mime:: AbstractString , @nospecialize x) = display (MIME (mime), x)
180
180
181
181
"""
182
182
displayable(mime) -> Bool
@@ -201,12 +201,12 @@ objects are printed in the Julia REPL.)
201
201
struct TextDisplay <: AbstractDisplay
202
202
io:: IO
203
203
end
204
- display (d:: TextDisplay , M:: MIME"text/plain" , x) = show (d. io, M, x)
205
- display (d:: TextDisplay , x) = display (d, MIME " text/plain" (), x)
204
+ display (d:: TextDisplay , M:: MIME"text/plain" , @nospecialize x) = show (d. io, M, x)
205
+ display (d:: TextDisplay , @nospecialize x) = display (d, MIME " text/plain" (), x)
206
206
207
207
# if you explicitly call display("text/foo", x), it should work on a TextDisplay:
208
208
displayable (d:: TextDisplay , M:: MIME ) = istextmime (M)
209
- function display (d:: TextDisplay , M:: MIME , x)
209
+ function display (d:: TextDisplay , M:: MIME , @nospecialize x)
210
210
displayable (d, M) || throw (MethodError (display, (d, M, x)))
211
211
show (d. io, M, x)
212
212
end
@@ -254,7 +254,7 @@ function reinit_displays()
254
254
pushdisplay (TextDisplay (stdout ))
255
255
end
256
256
257
- xdisplayable (D:: AbstractDisplay , args... ) = applicable (display, D, args... )
257
+ xdisplayable (D:: AbstractDisplay , @nospecialize args... ) = applicable (display, D, args... )
258
258
259
259
"""
260
260
display(x)
@@ -280,7 +280,7 @@ variants, one can also supply the "raw" data in the requested MIME type by passi
280
280
`x::AbstractString` (for MIME types with text-based storage, such as text/html or
281
281
application/postscript) or `x::Vector{UInt8}` (for binary MIME types).
282
282
"""
283
- function display (x)
283
+ function display (@nospecialize x)
284
284
for i = length (displays): - 1 : 1
285
285
if xdisplayable (displays[i], x)
286
286
try
@@ -294,7 +294,7 @@ function display(x)
294
294
throw (MethodError (display, (x,)))
295
295
end
296
296
297
- function display (m:: MIME , x)
297
+ function display (m:: MIME , @nospecialize x)
298
298
for i = length (displays): - 1 : 1
299
299
if xdisplayable (displays[i], m, x)
300
300
try
@@ -339,7 +339,7 @@ Using `redisplay` is also a hint to the backend that `x` may be redisplayed
339
339
several times, and the backend may choose to defer the display until
340
340
(for example) the next interactive prompt.
341
341
"""
342
- function redisplay (x)
342
+ function redisplay (@nospecialize x)
343
343
for i = length (displays): - 1 : 1
344
344
if xdisplayable (displays[i], x)
345
345
try
@@ -353,7 +353,7 @@ function redisplay(x)
353
353
throw (MethodError (redisplay, (x,)))
354
354
end
355
355
356
- function redisplay (m:: Union{MIME,AbstractString} , x)
356
+ function redisplay (m:: Union{MIME,AbstractString} , @nospecialize x)
357
357
for i = length (displays): - 1 : 1
358
358
if xdisplayable (displays[i], m, x)
359
359
try
@@ -368,8 +368,8 @@ function redisplay(m::Union{MIME,AbstractString}, x)
368
368
end
369
369
370
370
# default redisplay is simply to call display
371
- redisplay (d:: AbstractDisplay , x) = display (d, x)
372
- redisplay (d:: AbstractDisplay , m:: Union{MIME,AbstractString} , x) = display (d, m, x)
371
+ redisplay (d:: AbstractDisplay , @nospecialize x) = display (d, x)
372
+ redisplay (d:: AbstractDisplay , m:: Union{MIME,AbstractString} , @nospecialize x) = display (d, m, x)
373
373
374
374
# ##########################################################################
375
375
0 commit comments