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

Key: BOO-927
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Cedric Vivier
Reporter: Onur Gumus
Votes: 0
Watchers: 2
Operations

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

Method OverLoad Resolution With Predicates

Created: 16/Dec/07 04:38 PM   Updated: 13/Jan/08 07:05 AM
Component/s: Compiler
Affects Version/s: 0.8
Fix Version/s: 0.8.1

Time Tracking:
Not Specified

File Attachments: 1. Text File genericmethodoverload-v4.patch (7 kb)
2. Text File genericsoverloading-v5.patch (9 kb)

Environment: mono /linux
Issue Links:
Related
 

Testcase included: yes
Patch Submitted: Yes


 Description  « Hide
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



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Cedric Vivier - 16/Dec/07 06:20 PM
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


Onur Gumus - 17/Dec/07 03:15 AM
your patch is applied fine. Still no improvements on predicate example. It doesn't work!

Onur Gumus - 17/Dec/07 03:24 AM
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.


Cedric Vivier - 17/Dec/07 03:54 AM
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.


Avishay Lavie - 17/Dec/07 02:36 PM
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.


Onur Gumus - 17/Dec/07 03:04 PM
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.


Cedric Vivier - 13/Jan/08 07:05 AM
fixed in rev. 2811