|
Improve user-defined conversion handling.
* convert.cs (GetConversionOperators): Rewrite. Return only the
applicable operators.
(AddConversionOperators): New. Helper for GetConversionOperators.
(FindMostEncompassedType, FindMostEncompassingType): Verify that
there is only one most encompassed/encompassing type.
(FindMostSpecificSource, FindMostSpecificTarget): Remove
"applicable operator" handling.
(UserConversion): Move cache here from GetConversionOperators.
Directly cache the chosen operator, rather than the whole
MethodGroup.
(ExplicitNumericConversion): Fix buggy implementation of Decimal
case. Allow conversion of decimal to sbyte and byte too.
* expression.cs (EmptyExpression.Grab, EmptyExpression.Release):
New static methods. Used to avoid allocating EmptyExpressions in
convert.cs.
In errors:
* cs0173-3.cs: Rename from cs0172-2.cs. CSC 1.1 reports CS0173,
CSC 2.0.40607 reports CS0172. CS0173 is somewhat more appropriate
since the conversion is ambiguous.
In tests:
* test-387.cs: New test from #54928.
svn path=/trunk/mcs/; revision=45046
|