You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Reorganise Converter.HastNarrowingConversion
* Improve overload resolution rules
* Review int tests in test_methodbinder2
* Resolve numerical extensibles like their underlyings
* Prevent cast from float to int (#828) for all integer types
* Review integer tests of methodbinder2
* Move rules for BigInt to Int64/32 from narrowing level to PythonOverloadResolver
* Add tests using Extensible<double>
* Increase test coverage for binding cases involving BigInteger
* Correct comments
// This block codifies the following set of rules for Python numerics (i.e. numeric types and any derived types):
87
+
// 1. Prefer the parameter that is of the matching kind to the argument type (i.e. floating-point to floating-point, or integer to integer).
88
+
// 2. If both parameters are of the matching kind, break the tie by prefering the one that is wider, if any (so the chance of overflow is lower).
89
+
// "Wider" here means being able to represent all values of the narrower type; e.g. in this sense UInt64 is not wider than SByte.
90
+
// There are the following exceptions to these rules:
91
+
// * Rule 1 is not applied to user-defined subtypes (i.e. subclasses of Extensible<T>). This is to allow such types to bind to parameters
92
+
// of type object or an interface on Extensible<T> (rule from the DLR). It is because a user-defined type may have user-defined operators
93
+
// that may need to be inspected by the overload and provide additional functionality above a simple numeric value.
94
+
// * Rule 2 is not applied on narrowing level None, so in a case of a widening cast or a perfect type match, the most efficient (narrowest)
95
+
// type is selected (rule from the DLR).
96
+
// * If one of the parameters is Boolean and the other is numeric, the Boolean parameter is treated as a 1-bit-wide numeric (thus becomes a case for Rule 2).
97
+
// This makes the preference for numeric types over Boolean consistent with the one encoded using narrowing levels and conversion sequence.
98
+
// TODO: Increase test coverage for cases involving Complex, Decimal, Half
0 commit comments