[jira] Created: (BOO-1061) Use of IEquatable[of T] with value types can trigger NullReferenceExceptions

View: New views
2 Messages — Rating Filter:   Alert me  

[jira] Created: (BOO-1061) Use of IEquatable[of T] with value types can trigger NullReferenceExceptions

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Use of IEquatable[of T] with value types can trigger NullReferenceExceptions
----------------------------------------------------------------------------

                 Key: BOO-1061
                 URL: http://jira.codehaus.org/browse/BOO-1061
             Project: Boo
          Issue Type: Bug
         Environment: Windows, SVN 3012
            Reporter: Greg Nagel
            Priority: Minor


{code}
import System

struct A(IEquatable[of A]):
       
        _data as int
       
        def Equals(other as A):
                return _data == other._data


a = A()
b as IEquatable[of A] = A()
x as IEquatable[of A] = null

assert not a.Equals(x)
assert not b.Equals(x)
{code}

Both assertions fail above, whereas a == x and b == x work fine. Apparently the operator calls go through Boo.Lang.Runtime.RuntimeServices and are handled correctly, but a.Equals(x) and b.Equals(x) remain unchanged. It could be caused by the .net framework itself.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (BOO-1061) Use of IEquatable[of T] with value types can trigger NullReferenceExceptions

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/BOO-1061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=139589#action_139589 ]

Greg Nagel commented on BOO-1061:
---------------------------------

Er, the assertions don't fail, the statements throw a NullReferenceException. Either the statement's somehow getting switched around or it's doing something bad trying to unbox x instead of calling object.Equals.

> Use of IEquatable[of T] with value types can trigger NullReferenceExceptions
> ----------------------------------------------------------------------------
>
>                 Key: BOO-1061
>                 URL: http://jira.codehaus.org/browse/BOO-1061
>             Project: Boo
>          Issue Type: Bug
>         Environment: Windows, SVN 3012
>            Reporter: Greg Nagel
>            Priority: Minor
>
> {code}
> import System
> struct A(IEquatable[of A]):
>
> _data as int
>
> def Equals(other as A):
> return _data == other._data
> a = A()
> b as IEquatable[of A] = A()
> x as IEquatable[of A] = null
> assert not a.Equals(x)
> assert not b.Equals(x)
> {code}
> Both assertions fail above, whereas a == x and b == x work fine. Apparently the operator calls go through Boo.Lang.Runtime.RuntimeServices and are handled correctly, but a.Equals(x) and b.Equals(x) remain unchanged. It could be caused by the .net framework itself.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


LightInTheBox - Buy quality products at wholesale price