Boo
  1. Boo
  2. BOO-927

Method OverLoad Resolution With Predicates

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.8.1
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      mono /linux
    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Description

      There was a resent bug that prevents us to access overloaded methods if there is a generic case. Cedric's patch resolved this issue.

      However currently a predicate argument containing method still cannot be resolved correctly
      The following does not work:

      Boo :
      import db4mo from "db4mo.dll"

      db = db4mo()

      db.Query[of db4mo](

      {pilot as db4mo| return true}

      )

      //////////////
      C#:

      using System;

      public class db4mo
      {

      public void Query<T>(T t)

      { Console.WriteLine(t); }

      public void Query<T>(System.Predicate<T> t)

      { Console.WriteLine("Generic Query"); }

      }

      That seems tome only a problem when the argument is a predicate but not sure

      1. genericsoverloading-v5.patch
        9 kB
        Cedric Vivier
      2. genericmethodoverload-v4.patch
        7 kB
        Cedric Vivier

        Issue Links

          Activity

          Hide
          Cedric Vivier added a comment -

          New patch fixing internal method overloading.
          I have a small problem with my mono setup right now so I cannot test your testcase with predicate, please try it.

          the following testcases work ok here :
          internal : http://monoport.com/5915
          external : http://monoport.com/5916 (as library) and http://monoport.com/5917

          Show
          Cedric Vivier added a comment - New patch fixing internal method overloading. I have a small problem with my mono setup right now so I cannot test your testcase with predicate, please try it. the following testcases work ok here : internal : http://monoport.com/5915 external : http://monoport.com/5916 (as library) and http://monoport.com/5917
          Hide
          Onur Gumus added a comment -

          your patch is applied fine. Still no improvements on predicate example. It doesn't work!

          Show
          Onur Gumus added a comment - your patch is applied fine. Still no improvements on predicate example. It doesn't work!
          Hide
          Onur Gumus added a comment -

          This really seems to be an issue with Predicates. simply method overloading resolution fails when we send a delegate as a parameter as below.

          test.boo(5,19): BCE0017: The best overload for the method 'db4mo.Query(db4mo)' is not compatible with the argument list '(callable(db4mo) as bool)'.
          1 error(s).

          Other than that everything seems working even with generic method overloading etc.

          Show
          Onur Gumus added a comment - This really seems to be an issue with Predicates. simply method overloading resolution fails when we send a delegate as a parameter as below. test.boo(5,19): BCE0017: The best overload for the method 'db4mo.Query(db4mo)' is not compatible with the argument list '(callable(db4mo) as bool)'. 1 error(s). Other than that everything seems working even with generic method overloading etc.
          Hide
          Cedric Vivier added a comment -

          New patch v5 against clean trunk fixing two other testcases from BOO-928

          Still not fixing the Predicate related one but we get closer and closer.

          Show
          Cedric Vivier added a comment - New patch v5 against clean trunk fixing two other testcases from BOO-928 Still not fixing the Predicate related one but we get closer and closer.
          Hide
          Avishay Lavie added a comment -

          I think we're facing several different problems here, and it'd be easier if we treated them as separate issues.

          The generic method overloads issue should be solvable entirely within CallableResolutionService (if I'm not mistaken the code for preferring non-generic methods over generic ones is in place, only commented out). This is recorded in BOO-824.
          The conflict between types with the same name and varying levels of generity is a different matter, recorded in BOO-928.
          The predicates issue recorded in here is a third issue which, I suspect, stems from a deeper problem.

          At any rate, BOO-927, BOO-928 and BOO-824 give a good separation of the different issues. I'd rather not merge them into one or mark any one of them a duplicate of the other.

          Show
          Avishay Lavie added a comment - I think we're facing several different problems here, and it'd be easier if we treated them as separate issues. The generic method overloads issue should be solvable entirely within CallableResolutionService (if I'm not mistaken the code for preferring non-generic methods over generic ones is in place, only commented out). This is recorded in BOO-824 . The conflict between types with the same name and varying levels of generity is a different matter, recorded in BOO-928 . The predicates issue recorded in here is a third issue which, I suspect, stems from a deeper problem. At any rate, BOO-927 , BOO-928 and BOO-824 give a good separation of the different issues. I'd rather not merge them into one or mark any one of them a duplicate of the other.
          Hide
          Onur Gumus added a comment -

          I made some small tests about predicate issue. In deed it has nothing to do with Predicates. The problem occurs if The method is generic AND method has generic parameters AND it has an overload wheater generic or non generic.

          IF these 3 conditions supplied the bug is produced. Forexample in C#

          public Query<T>(T t)

          {... }

          public Query<T>(List<T> list) {... }

          In this case if you call 1st method compilation succeeds. If you call the second compilation fails because of the above reason.

          Show
          Onur Gumus added a comment - I made some small tests about predicate issue. In deed it has nothing to do with Predicates. The problem occurs if The method is generic AND method has generic parameters AND it has an overload wheater generic or non generic. IF these 3 conditions supplied the bug is produced. Forexample in C# public Query<T>(T t) {... } public Query<T>(List<T> list) {... } In this case if you call 1st method compilation succeeds. If you call the second compilation fails because of the above reason.
          Hide
          Cedric Vivier added a comment -

          fixed in rev. 2811

          Show
          Cedric Vivier added a comment - fixed in rev. 2811

            People

            • Assignee:
              Cedric Vivier
              Reporter:
              Onur Gumus
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: