Skip to content

Commit 0f5f0ba

Browse files
committed
Dont PyObjects precedence in Operator methods
1 parent b0aca5c commit 0f5f0ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/runtime/methodbinder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ private static int GetPrecedence(MethodInformation methodInformation)
200200
val += mi.IsGenericMethod ? 1 : 0;
201201
for (var i = 0; i < num; i++)
202202
{
203-
val += ArgPrecedence(pi[i].ParameterType);
203+
val += ArgPrecedence(pi[i].ParameterType, methodInformation);
204204
}
205205

206206
var info = mi as MethodInfo;
207207
if (info != null)
208208
{
209-
val += ArgPrecedence(info.ReturnType);
209+
val += ArgPrecedence(info.ReturnType, methodInformation);
210210
val += mi.DeclaringType == mi.ReflectedType ? 0 : 3000;
211211
}
212212

@@ -216,15 +216,15 @@ private static int GetPrecedence(MethodInformation methodInformation)
216216
/// <summary>
217217
/// Return a precedence value for a particular Type object.
218218
/// </summary>
219-
internal static int ArgPrecedence(Type t)
219+
internal static int ArgPrecedence(Type t, MethodInformation mi)
220220
{
221221
Type objectType = typeof(object);
222222
if (t == objectType)
223223
{
224224
return 3000;
225225
}
226226

227-
if (t.IsAssignableFrom(typeof(PyObject)))
227+
if (t.IsAssignableFrom(typeof(PyObject)) && !OperatorMethod.IsOperatorMethod(mi.MethodBase))
228228
{
229229
return -1;
230230
}
@@ -283,7 +283,7 @@ internal static int ArgPrecedence(Type t)
283283
{
284284
return 2500;
285285
}
286-
return 100 + ArgPrecedence(e);
286+
return 100 + ArgPrecedence(e, mi);
287287
}
288288

289289
return 2000;

0 commit comments

Comments
 (0)