Skip to content

Commit 882ccb6

Browse files
committed
DRAFT: only use a single overload automatically, require explicit call otherwise
1 parent c4325dd commit 882ccb6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/runtime/MethodBinder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,10 +516,14 @@ public MismatchedMethod(Exception exception, MethodBase mb)
516516
// type of the arguments and use it to construct the correct method.
517517
Type[]? types = Runtime.PythonArgsToTypeArray(args, true);
518518
MethodInfo[] overloads = MatchParameters(methods, types);
519-
if (overloads.Length != 0)
519+
if (overloads.Length == 1)
520520
{
521521
return Bind(inst, args, kwargDict, overloads, matchGenerics: false);
522522
}
523+
else
524+
{
525+
Exceptions.RaiseTypeError("Ambiguous overload");
526+
}
523527
}
524528
if (mismatchedMethods.Count > 0)
525529
{

0 commit comments

Comments
 (0)