IronLanguages / IronLanguages/ironpython3

Extension binder fails to resolve overloads with nested generics

Open
#1,796 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

.NET interop
Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

For example, in .NET 8 the following overload is added:

public static Dictionary<TKey,TValue> ToDictionary<TKey,TValue> (this IEnumerable<KeyValuePair<TKey,TValue>> source);

Since PythonDictionary is an IEnumerable<KeyValuePair<object, object>> the extension method should be callable:

import clr
clr.AddReference("System.Linq")
from System.Linq import Enumerable
clr.ImportExtensions(Enumerable)
{}.ToDictionary()

This causes an assertion error when running test_cliclass.test_extension_methods in Debug mode.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the assertion by running test_cliclass.test_extension_methods in Debug mode, using the nested-generic ToDictionary overload described in the issue. Trace extension binder overload resolution for IEnumerable<KeyValuePair<object, object>> and verify that the test passes when the overload is callable without an assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.