SIGN IN SIGN UP

errorshow: Hint on same-named types from different modules (#61648)

when you have types of the same name but different modules, and
accidentally pass the wrong one to a function, the `MethodError` can be
confusing until you realize what happened. this attempts to add a hint
to alleviate that.

example:
```julia
julia> module Geometry
           struct Point
               x::Float64
               y::Float64
           end
           translate(p::Point, dx, dy) = Point(p.x + dx, p.y + dy)
       end
Main.Geometry

julia> struct Point
           lat::Float64
           lon::Float64
       end

julia> p = Point(40.7, -74.0);

julia> Geometry.translate(p, 1, 2)

# BEFORE
ERROR: MethodError: no method matching translate(::Point, ::Int64, ::Int64)
The function `translate` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  translate(::Main.Geometry.Point, ::Any, ::Any)
   @ Main.Geometry REPL[3]:6


# AFTER
ERROR: MethodError: no method matching translate(::Point, ::Int64, ::Int64)
You may have intended `Main.Geometry.Point` rather than `Main.Point`.
The function `translate` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  translate(::Main.Geometry.Point, ::Any, ::Any)
   @ Main.Geometry REPL[4]:6
```



fixes #41084
half claude half me

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A
Andy Dienes committed
8bdf88f3fa296390001b8a9abeb1be5c944c4fe4
Parent: 6bf6602
Committed by GitHub <noreply@github.com> on 5/7/2026, 9:48:16 PM