Skip to content

Conversation

@riazation42
Copy link
Contributor

Fixes #59522

Summary

Added module prefix display in stacktraces when methods extend functions from different modules.

Changes

Modified show_spec_sig function in base/stacktraces.jl to detect and display module qualification when needed.

Implementation

The solution extracts the function owner from the signature type, compares it with the method's module, and enables qualified printing when they differ.

Testing

Built Julia from source using WSL and tested with module extension scenario:

module A
    foo(x::Float64) = error("Error in A.foo")
end

module B
    using ..A
    A.foo(x::Int) = A.foo(Float64(x))
end

B.A.foo(42)

screenshot showing the stacktrace with module qualification:
stacktrace fix

Line [2] shows foo(x::Float64) without prefix (same module)
Line [3] shows Main.A.foo(x::Int64) with prefix (different modules)

Note: Used Claude (Anthropic) to assist with building Julia from source in WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stacktraces do not print a function's Module, even when required for disambiguation

2 participants