Boo

Compiler cannot disambiguate between non-generic and generic with the same name (including generic with a different number of generic parameters)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.1
  • Fix Version/s: 0.8.1
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

(forked from BOO-882)

The compiler cannot disambiguate between different callables with the similar signature, where the callables have a different number of generic parameters.

class Class:
  def Method(arg as int):
    return "regular method"

  def Method[of T](arg as T):
    return "generic method"

c = Class()
print c.Method(42)

The code above should print "regular method", but gives a "cannot resolve ambiguous member" error.

According to the C# spec, the most specific member should be selected - in this case, the one with no generic arguments.

Issue Links

Activity

Hide
Marcus Griep added a comment -

A testcase:

public class Foo
{
    public static void Do(string s)
    {
        
    }

    public static void Do<T>(string s)
    {
        
    }
}

#Boo errors on this line:
Foo.Do("foo")

Gives this error:

BCE0004: Ambiguous reference 'Do': BooError.Foo.Do(string), BooError.Foo.Do(string)
Show
Marcus Griep added a comment - A testcase:
public class Foo
{
    public static void Do(string s)
    {
        
    }

    public static void Do<T>(string s)
    {
        
    }
}

#Boo errors on this line:
Foo.Do("foo")
Gives this error:
BCE0004: Ambiguous reference 'Do': BooError.Foo.Do(string), BooError.Foo.Do(string)
Hide
Avishay Lavie added a comment -

Resolved in r2919.
Thanks Marcus for adding testcases, I forgot to add mine (which were inferior anyway).

Show
Avishay Lavie added a comment - Resolved in r2919. Thanks Marcus for adding testcases, I forgot to add mine (which were inferior anyway).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: