main icon indicating copy to clipboard operation
main copied to clipboard

Investigate non-public structs and equality

Open ironpythonbot opened this issue 10 years ago • 0 comments

We should be able to compare non-public structs but currently it doesn't work. State in the tokenizer was made public because of this.

import clr  
clr.AddReference('test')  
import X  
X.Baz()  
Traceback (most recent call last):  
File "<stdin>", line 1, in <module>  
ValueError: Can only unbox from an object or interface type to a value type.  
Parameter name: type  

test.cs contains:

using System;  

struct Foo {  
    int a;

    public override bool Equals(object other) {
        return false;
    }
}  

public class X {  
    public static object Baz() {
        return new Foo();
    }
}

Work Item Details

Original CodePlex Issue: Issue 22148 Status: Active Reason Closed: Unassigned Assigned to: Unassigned Reported on: Apr 22, 2009 at 11:52 PM Reported by: dinov Updated on: Feb 22, 2013 at 2:13 AM Updated by: jdhardy

ironpythonbot avatar Dec 09 '14 17:12 ironpythonbot