@@ -74,7 +74,7 @@ Base.show_method_candidates(buf, Base.MethodError(method_c1,(1, 1, 1)))
74
74
# matches the implicit constructor -> convert method
75
75
Base. show_method_candidates (buf, Base. MethodError (Tuple{}, (1 , 1 , 1 )))
76
76
let mc = String (take! (buf))
77
- @test occursin (" \n Closest candidates are:\n Tuple{} " , mc)
77
+ @test occursin (" \n Closest candidates are:\n (::Type{T}) " , mc)
78
78
@test ! occursin (cfile, mc)
79
79
end
80
80
@@ -124,10 +124,13 @@ PR16155line2 = @__LINE__() + 1
124
124
(:: Type{T} )(arg:: Any ) where {T<: PR16155 } = " replace call-to-convert method from sysimg"
125
125
126
126
Base. show_method_candidates (buf, MethodError (PR16155,(1.0 , 2.0 , Int64 (3 ))))
127
- @test String (take! (buf)) == " \n Closest candidates are:\n $(curmod_prefix) PR16155(::Any, ::Any)$cfile$PR16155line \n $(curmod_prefix) PR16155(!Matched::Int64, ::Any)$cfile$PR16155line \n $(curmod_prefix) PR16155 (::Any) where T<:$(curmod_prefix) PR16155$cfile$PR16155line2 "
127
+ @test String (take! (buf)) == " \n Closest candidates are:\n $(curmod_prefix) PR16155(::Any, ::Any)$cfile$PR16155line \n $(curmod_prefix) PR16155(!Matched::Int64, ::Any)$cfile$PR16155line \n (::Type{T}) (::Any) where T<:$(curmod_prefix) PR16155$cfile$PR16155line2 "
128
128
129
129
Base. show_method_candidates (buf, MethodError (PR16155,(Int64 (3 ), 2.0 , Int64 (3 ))))
130
- @test String (take! (buf)) == " \n Closest candidates are:\n $(curmod_prefix) PR16155(::Int64, ::Any)$cfile$PR16155line \n $(curmod_prefix) PR16155(::Any, ::Any)$cfile$PR16155line \n $(curmod_prefix) PR16155(::Any) where T<:$(curmod_prefix) PR16155$cfile$PR16155line2 "
130
+ @test String (take! (buf)) == " \n Closest candidates are:\n $(curmod_prefix) PR16155(::Int64, ::Any)$cfile$PR16155line \n $(curmod_prefix) PR16155(::Any, ::Any)$cfile$PR16155line \n (::Type{T})(::Any) where T<:$(curmod_prefix) PR16155$cfile$PR16155line2 "
131
+
132
+ Base. show_method_candidates (buf, MethodError (Complex{T} where T<: Integer , (1.2 ,)))
133
+ @test startswith (String (take! (buf)), " \n Closest candidates are:\n (::Type{T})(::T) where T<:Number" )
131
134
132
135
c6line = @__LINE__
133
136
method_c6 (; x= 1 ) = x
@@ -396,6 +399,9 @@ EightBitTypeT{T}() where {T} = throw(ErrorException("6"))
396
399
(:: EightBitTypeT )() = throw (ErrorException (" 7" ))
397
400
(:: FunctionLike )() = throw (ErrorException (" 8" ))
398
401
402
+ struct StructWithUnionAllMethodDefs{T}
403
+ end
404
+ (:: Type{StructWithUnionAllMethodDefs{T} where T<:Integer} )(x) = x
399
405
400
406
let err_str,
401
407
i = reinterpret (EightBitType, 0x54 ),
@@ -412,15 +418,19 @@ let err_str,
412
418
@test sprint (show, which (reinterpret (EightBitType, 0x54 ), Tuple{})) ==
413
419
" (::$(curmod_prefix) EightBitType)() in $curmod_str at $sp :$(method_defs_lineno + 3 ) "
414
420
@test sprint (show, which (EightBitTypeT, Tuple{})) ==
415
- " (::Type{ $(curmod_prefix) EightBitTypeT}) () in $curmod_str at $sp :$(method_defs_lineno + 4 ) "
421
+ " $(curmod_prefix) EightBitTypeT() in $curmod_str at $sp :$(method_defs_lineno + 4 ) "
416
422
@test sprint (show, which (EightBitTypeT{Int32}, Tuple{})) ==
417
- " (::Type{ $(curmod_prefix) EightBitTypeT{T}}) () where T in $curmod_str at $sp :$(method_defs_lineno + 5 ) "
423
+ " $(curmod_prefix) EightBitTypeT{T}() where T in $curmod_str at $sp :$(method_defs_lineno + 5 ) "
418
424
@test sprint (show, which (reinterpret (EightBitTypeT{Int32}, 0x54 ), Tuple{})) ==
419
425
" (::$(curmod_prefix) EightBitTypeT)() in $curmod_str at $sp :$(method_defs_lineno + 6 ) "
426
+ @test startswith (sprint (show, which (Complex{Int}, Tuple{Int})),
427
+ " Complex{T}(" )
420
428
@test startswith (sprint (show, which (getfield (Base, Symbol (" @doc" )), Tuple{LineNumberNode, Module, Vararg{Any}})),
421
429
" @doc(__source__::LineNumberNode, __module__::Module, x...) in Core at boot.jl:" )
422
430
@test startswith (sprint (show, which (FunctionLike (), Tuple{})),
423
431
" (::$(curmod_prefix) FunctionLike)() in $curmod_str at $sp :$(method_defs_lineno + 7 ) " )
432
+ @test startswith (sprint (show, which (StructWithUnionAllMethodDefs{<: Integer }, (Any,))),
433
+ " ($(curmod_prefix) StructWithUnionAllMethodDefs{T} where T<:Integer)(x)" )
424
434
@test repr (" text/plain" , FunctionLike ()) == " (::$(curmod_prefix) FunctionLike) (generic function with 1 method)"
425
435
@test repr (" text/plain" , Core. arraysize) == " arraysize (built-in function)"
426
436
0 commit comments