-
-
Couldn't load subscription status.
- Fork 5.7k
Closed
Labels
regressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous versiontypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
This is reduced from a failure in StrBase on backports-1.2.0:
struct Str{C} <: AbstractString
end
struct CSE{X}
end
UTF16CSE = CSE{1}
UTF16Str = Str{UTF16CSE}
ASCIICSE = CSE{2}
ASCIIStr = Str{ASCIICSE}
conv(::Type{<:Str{UTF16CSE}}, str::AbstractString) = 42
conv(::Type{<:Str{C}}, str::Str{C}) where {C<:CSE} = str
conv(UTF16Str, ASCIIStr())
julia> conv(UTF16Str, ASCIIStr())
ERROR: MethodError: conv(::Type{Str{CSE{1}}}, ::Str{CSE{2}}) is ambiguous. Candidates:
conv(::Type{#s1} where #s1<:Str{C}, str::Str{C}) where C<:CSE in Main at REPL[9]:1
conv(::Type{#s1} where #s1<:Str{CSE{1}}, str::AbstractString) in Main at REPL[8]:1
Possible fix, define
conv(::Type{#s1} where #s1<:Str{CSE{1}}, ::Str{CSE{1}})
Stacktrace:
[1] top-level scope at REPL[10]:1
The methods are indeed ambiguous, but not at the arguments passed in this case. Works on 1.1.
Metadata
Metadata
Assignees
Labels
regressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous versiontypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch