IronLanguages / IronLanguages/ironpython3

Overload resolver incorrectly resolves when both 32 and 64-bit parameter type present

Open
#868 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

If a method group has two methods that only differ in the bit-size of an integer parameter type (e.g. uint and ulong), the wider type overload is not selected, even if the value would require it.

Examples:

>>> import System
>>> System.UIntPtr(0xFFFFFFFFFFFFFFFF)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Value was either too large or too small for a UInt32.

Also, it seems to prefer double over uint or ulong:

>>> System.Math.Max(0x7FFFFFFF,1)
2147483647
>>> System.Math.Max(0x80000000,1)
2.14748e+09

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 examples in the IronPython interactive shell, especially System.UIntPtr with the 64-bit value and System.Math.Max around the 32-bit boundary. Trace the overload resolution path for these calls; done means the appropriate uint or ulong overload is selected when required instead of raising a UInt32 overflow or preferring double.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.