Closed patrickpichler closed 3 months ago
Indeed, what you're seeing is a signature overlap which would make dispatch ambiguous. If you have a singleton binding, then just use the parameterized overload. The type parameter will decay to dyn
so it's possible for the more specific overload to collide with the parameterized type.
The concrete problem we are facing is, that we wanted to add an overload to the in
and ==
operators to allow testing for uint
== int
. It seems like there is code to compare both types, but it sadly requires a typecast of the uint
to int
to work.
Do you know of any other way of achieving this (given that we do not want to change our data model types from uint
to int
if possible)?
Describe the bug When defining an overload for a function that has multiple generic types, the
SignatureOverlaps
checker looks at each type parameter in isolation, causing it to reject valid overlaps.To Reproduce
Expected behavior Creating the environment should not fail.
Additional context After some initial analysis, I guess the problem is caused by the SignatureOverlap function looking at each instance of the type parameter used in isolation.
A
is assignable touint
andlist(A)
is assignable tolist(int)
, even thoughA
in this case should point to a single type.