[jira] Created: (BOO-1211) No error when passing a type to a local or field whose type is an interface

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

[jira] Created: (BOO-1211) No error when passing a type to a local or field whose type is an interface

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

Reply to Author | View Threaded | Show Only this Message

No error when passing a type to a local or field whose type is an interface
---------------------------------------------------------------------------

                 Key: BOO-1211
                 URL: http://jira.codehaus.org/browse/BOO-1211
             Project: Boo
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 0.9.1
            Reporter: Cedric Vivier
            Assignee: Cedric Vivier
             Fix For: 0.9.2


Funny one :

{code}
class Foo:
    pass

foo = Foo()
i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
{code}

This obviously fail at runtime.


--
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] Work started: (BOO-1211) No error when passing a type to a local or field whose type is an interface

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on BOO-1211 started by Cedric Vivier.

> No error when passing a type to a local or field whose type is an interface
> ---------------------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> {code}
> This obviously fail at runtime.

--
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-1211) No error when passing a type to a local or field whose type is an interface

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

Reply to Author | View Threaded | Show Only this Message


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

Cedric Vivier commented on BOO-1211:
------------------------------------

Hmm this seems to have been introduce by the TypeSystem refactoring.
As long as a left-hand or right-hand expression is an interface (not final) then anything goes


Two testcases using this have been added later:

tests/testcases/integration/operators/cast-6.boo
tests/testcases/integration/types/interfaces-20.boo


Is it intentional? am not sure to get what's the rationale/usecase about it?
Considering the dangers of such a kind of downcasting (I only detected this quite late at run-time because of a typo..) should we allow it only when an explicit cast to interface is present maybe?




> No error when passing a type to a local or field whose type is an interface
> ---------------------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> {code}
> This obviously fail at runtime.

--
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] Updated: (BOO-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cedric Vivier updated BOO-1211:
-------------------------------

    Summary: No type safety at all if LHS or RHS of expression is an interface  (was: No error when passing a type to a local or field whose type is an interface)

> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> {code}
> This obviously fail at runtime.

--
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] Updated: (BOO-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cedric Vivier updated BOO-1211:
-------------------------------

    Fix Version/s: 0.8.2
                   0.9

> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.8.2, 0.9, 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> {code}
> This obviously fail at runtime.

--
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] Updated: (BOO-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cedric Vivier updated BOO-1211:
-------------------------------

    Description:
Funny one :

{code}
class Foo:
    pass

foo = Foo()
i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
i = foo #oh but even without the typo this also compiles successfully since `i''s type is an interface
{code}

This obviously fail at run-time.


  was:
Funny one :

{code}
class Foo:
    pass

foo = Foo()
i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
{code}

This obviously fail at runtime.



> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.8.2, 0.9, 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> i = foo #oh but even without the typo this also compiles successfully since `i''s type is an interface
> {code}
> This obviously fail at run-time.

--
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-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


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

Cedric Vivier commented on BOO-1211:
------------------------------------

Fwiw culprits introduced in TSS refactoring are lines 640,641 of TypeSystemServices.cs in AreTypesRelated:
                                || (lhs.IsInterface && !rhs.IsFinal)

                                || (rhs.IsInterface && !lhs.IsFinal)



> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.8.2, 0.9, 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> i = foo #oh but even without the typo this also compiles successfully since `i''s type is an interface
> {code}
> This obviously fail at run-time.

--
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-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


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

Cedric Vivier commented on BOO-1211:
------------------------------------

Proposal for type safety when using interfaces while still allowing interface downcasts when potentially available :

{code}
lass Fruit:
    pass
class Apple (Fruit, IFruit):
    pass
interface IFruit:
    pass
class Drink:
    pass


def Drop(a as Apple):
    pass
def Eat(f as IFruit):
    pass


fruit = Fruit()
drink = Drink()
odrink as object = Drink()

#object downcast (current behavior)
Drop(fruit)       #compiles
Drop(odrink)  #compiles
#Drop(drink)  #error since Drink is not in the hierarchy of Apple

#interface downcast
Eat(fruit)       #compiles
Eat(odrink)  #compiles
Eat(drink)    #current behavior: compiles though it will _always_ fail
                      #PROPOSAL: error since no type in Drink hierarchy implements IFruit
                      #                         if lhs or rhs is `object' any interface downcast is possible like today              
{code}


This would keep interface downcast working for use cases as integration/operators/casts-6.boo and integration/types/interfaces-20.boo.


> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.8.2, 0.9, 0.9.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> i = foo #oh but even without the typo this also compiles successfully since `i''s type is an interface
> {code}
> This obviously fail at run-time.

--
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] Updated: (BOO-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rodrigo B. de Oliveira updated BOO-1211:
----------------------------------------

    Fix Version/s:     (was: 0.9.2)
                   0.9.3

> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.8.2, 0.9, 0.9.3
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> i = foo #oh but even without the typo this also compiles successfully since `i''s type is an interface
> {code}
> This obviously fail at run-time.

--
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] Closed: (BOO-1211) No type safety at all if LHS or RHS of expression is an interface

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

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/BOO-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rodrigo B. de Oliveira closed BOO-1211.
---------------------------------------

    Resolution: Not A Bug

By design. Type safety in that case could only be guaranteed with closed world analysis.

> No type safety at all if LHS or RHS of expression is an interface
> -----------------------------------------------------------------
>
>                 Key: BOO-1211
>                 URL: http://jira.codehaus.org/browse/BOO-1211
>             Project: Boo
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 0.9.1
>            Reporter: Cedric Vivier
>            Assignee: Cedric Vivier
>             Fix For: 0.9.3, 0.9, 0.8.2
>
>
> Funny one :
> {code}
> class Foo:
>     pass
> foo = Foo()
> i as System.Collections.IEnumerable = Foo  #! typo type Foo not lowercase local foo
> i = foo #oh but even without the typo this also compiles successfully since `i''s type is an interface
> {code}
> This obviously fail at run-time.

--
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