IronLanguages / main

Work for this repo has moved to https://github.com/IronLanguages/ironpython2
1.16k stars 347 forks source link

IronPython ignores op_Implicit for coercion to user-defined types #744

Open ironpythonbot opened 9 years ago

ironpythonbot commented 9 years ago

Given classes that look like the following:

public abstract class Term {

public static Term op_Implicit(double x);
public static Term op_Addition(Term, Term);

}

public class Decision : Term {
}

From Python, when we say something like this:

a = Decision
b = 2.0 + a

the compiler gives an error saying that it can’t add a “float” to a “Decision”. It works if we say

a = Decision
b = Term.op_Implicit(2.0) + a

but this is pretty ugly.

Work Item Details

Original CodePlex Issue: Issue 24640 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Sep 14, 2009 at 10:09 PM Reported by: CurtHagenlocher Updated on: Jun 26, 2013 at 6:31 AM Updated by: jdhardy

Binary Attachments

testcase-24640.zip

ironpythonbot commented 9 years ago

On 2010-12-14 15:25:52 UTC, rjnienaber commented:

This still seems to be occurring in IronPython 2.7 Beta 1 (2.7.0.10) on .NET 4.0.30319.1. I've added testcase-24640.zip that recreates the issue.