Skip to content

Commit

Permalink
Don't list extension methods multiple times. (#836)
Browse files Browse the repository at this point in the history
* Don't list extension methods multiple times.

* Removed changes made to ExtensionMethodSet as the issue was fixed in the PythonExtensionBinder instead
  • Loading branch information
Simon900225 authored Dec 8, 2023
1 parent d001118 commit 31116c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Src/IronPython/Runtime/Binding/PythonExtensionBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public PythonExtensionBinder(PythonBinder binder, ExtensionMethodSet extensionMe
public override MemberGroup GetMember(MemberRequestKind actionKind, Type type, string name) {
var res = base.GetMember(actionKind, type, name);
if (res.Count == 0) {
List<MemberTracker> trackers = new List<MemberTracker>();
HashSet<MemberTracker> trackers = new HashSet<MemberTracker>();

foreach (var method in _extMethodSet.GetExtensionMethods(name)) {
var parameters = method.GetParameters();
Expand All @@ -35,11 +35,11 @@ public override MemberGroup GetMember(MemberRequestKind actionKind, Type type, s
var paramType = parameters[0].ParameterType;

if (IsApplicableExtensionMethod(type, paramType)) {
trackers.Add(MemberTracker.FromMemberInfo(method, paramType));
(trackers ??= new HashSet<MemberTracker>()).Add(MemberTracker.FromMemberInfo(method, paramType));
}
}

if (trackers.Count > 0) {
if (trackers is not null) {
return new MemberGroup(trackers.ToArray());
}
}
Expand Down

0 comments on commit 31116c9

Please sign in to comment.