Skip to content

Commit eb2435f

Browse files
committed
Allow specialization in show_convert_error
`arg_types_param` is known to be a `Core.SimpleVector`
1 parent f2dcc44 commit eb2435f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

base/errorshow.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,20 @@ function print_with_compare(io::IO, @nospecialize(a), @nospecialize(b), color::S
199199
end
200200
end
201201

202-
function show_convert_error(io::IO, ex::MethodError, @nospecialize(arg_types_param))
202+
function show_convert_error(io::IO, ex::MethodError, arg_types_param)
203203
# See #13033
204204
T = striptype(ex.args[1])
205205
if T === nothing
206206
print(io, "First argument to `convert` must be a Type, got ", ex.args[1])
207207
else
208-
print_one_line = isa(T, DataType) && isa(arg_types_param[2], DataType) && T.name != arg_types_param[2].name
208+
p2 = arg_types_param[2]
209+
print_one_line = isa(T, DataType) && isa(p2, DataType) && T.name != p2.name
209210
printstyled(io, "Cannot `convert` an object of type ")
210211
print_one_line || printstyled(io, "\n ")
211-
print_with_compare(io, arg_types_param[2], T, :light_green)
212+
print_with_compare(io, p2, T, :light_green)
212213
printstyled(io, " to an object of type ")
213214
print_one_line || printstyled(io, "\n ")
214-
print_with_compare(io, T, arg_types_param[2], :light_red)
215+
print_with_compare(io, T, p2, :light_red)
215216
end
216217
end
217218

0 commit comments

Comments
 (0)