-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
julia> struct _CtorSlotNarrowVal end
julia> Base.convert(::Type{_CtorSlotNarrowVal}, ::Any) = _CtorSlotNarrowVal()
julia> mutable struct _CtorSlotNarrowHolder
x::_CtorSlotNarrowVal
end
julia> Base.infer_effects(convert, Tuple{Type{_CtorSlotNarrowHolder}, Any})
(+c,+e,!n,+t,+s,+m,+u,+o,+r)
I was investigating where that nothrow taint was coming from. Turns out:
julia> Base.methods_including_ambiguous(convert, Tuple{Type{_CtorSlotNarrowVal}, Any})
# 2 methods for generic function "convert" from Base:
[1] convert(::Type{T}, x::T) where T
@ Base_compiler.jl:133
[2] convert(::Type{_CtorSlotNarrowVal}, ::Any)
@ REPL[9]:1
julia> convert(_CtorSlotNarrowVal, _CtorSlotNarrowVal())
ERROR: MethodError: convert(::Type{_CtorSlotNarrowVal}, ::_CtorSlotNarrowVal) is ambiguous.
Candidates:
convert(::Type{_CtorSlotNarrowVal}, ::Any)
@ Main REPL[16]:1
convert(::Type{T}, x::T) where T
@ Base Base_compiler.jl:133
Possible fix, define
convert(::Type{_CtorSlotNarrowVal}, ::_CtorSlotNarrowVal)
Stacktrace:
[1] top-level scope
@ REPL[19]:1
So it's smarter than me, but I feel like this should have been annotated in the callsite display.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels