History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-1016
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Cedric Vivier
Reporter: Spruce Weber
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Conflict between generic and non-generic methods overloads when return type is generic parameter

Created: 16/May/08 11:46 AM   Updated: 16/May/08 02:33 PM
Component/s: Compiler
Affects Version/s: 0.8.1
Fix Version/s: 0.8.2

Time Tracking:
Not Specified

Testcase included: yes


 Description  « Hide
Two test cases and corresponding errors follows...

interface ITest:
def DoSomething() as string

def DoSomething[of T]() as T

class Test(ITest):
def DoSomething() as string:
pass

def DoSomething[of T]() as T:
pass

Program.boo(10,9) : Error BCE0035: 'Test.DoSomething' conflicts with inherited member 'ITest.DoSomething'.
Program.boo(7,9) : Error BCE0035: 'Test.DoSomething' conflicts with inherited member 'ITest.DoSomething`1'.

class Test2Base:
virtual def DoSomething() as string:
pass

virtual def DoSomething[of T]() as T:
pass

class Test2(Test2Base):
def DoSomething() as string:
pass

def DoSomething[of T]() as T:
pass

Program.boo(12,32) : Error BCE0072: Overridden method 'Test2Base.DoSomething' has a return type of 'string' not 'Test2.DoSomething`1.T'.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Cedric Vivier - 16/May/08 12:06 PM
Hmm.. I guess the errors are legit aren't they?
interface ITest:
    def DoSomething() as string
    def DoSomething[of T](x as T) as string

class Test(ITest):
    def DoSomething() as string:
         pass
    def DoSomething[of T](x as T) as string:
         pass

Works.


Spruce Weber - 16/May/08 12:27 PM
I'm not sure they are. The C# equivalent seems to compile fine...
public interface ITest{ string DoSomething(); T DoSomething<T>(); }

public class Test:ITest
{
public string DoSomething(){return null;}

public T DoSomething<T>(){return default(T);}
}

By the way. What are the tags for the nice code formatting?


Cedric Vivier - 16/May/08 12:33 PM - edited
Hmm true, so this is ok only when return types differ because of genericity?

surround your code with {{ code }} (without spaces) for the nice formatting.


Spruce Weber - 16/May/08 01:48 PM
The C# version compiles regardless of whether or not the return types differ. Boo fails when the return types differ even when a non-generic type is returned from the generic method.

Cedric Vivier - 16/May/08 02:33 PM
Fixed in rev. 2952