suggest candidate methods on typename wrapper when parameterized call has no methods (#61700)
inspired by new-user confusion I've seen on discourse, example
https://discourse.julialang.org/t/scope-of-parametric-types-and-associated-error-messages/48928
```julia
julia> struct Foo{T}
x::T
Foo(x) = new{typeof(x)}(x)
end
# master
julia> Foo{Int}(1)
ERROR: MethodError: no method matching Foo{Int64}(::Int64)
The type `Foo{Int64}` exists, but no method is defined for this combination of argument types when trying to construct it.
Stacktrace:
[1] top-level scope
@ REPL[1]:1
# PR
julia> Foo{Int}(1)
ERROR: MethodError: no method matching Foo{Int64}(::Int64)
The type `Foo{Int64}` exists, but no method is defined for this combination of argument types when trying to construct it.
Closest candidates are:
Foo(::Any)
@ Main REPL[1]:3
Stacktrace:
[1] top-level scope
@ REPL[1]:1
```
this might be a little controversial since we're technically lying to
the user (it is a method on a different type than the one they passed)
but given that it would condition it only on `isempty(methods(f))` it
seems useful to me A
Andy Dienes committed
79fb4e935629b1e587760ae7817c1084debb70c0
Parent: ccd0279
Committed by GitHub <noreply@github.com>
on 5/15/2026, 12:01:21 PM