Wiki

Ticket #321 (new defect)

Opened 5 years ago

Last modified 4 years ago

Overload resolution needs improvement

Reported by: Charles Owned by:
Priority: major Milestone:
Component: Cobra Compiler Version: 0.9.3
Keywords: Cc:

Description

Cobra's method overload resolution skips certain method names with the following if guard in _bindImp of CallExpr?:

if winner.name not in ['format', 'invoke', 'split', 'sort']

That indicates that 3rd party libraries are going to have problems which currently have no workaround (other than using a sharp string).

Note that since Cobra uses C# as a back-end, it will largely need to match C#'s overload resolution with the exception that since extension methods can be called explicitly as static/shared methods, Cobra may bind to those in cases where C# would not.

See also: ticket:189

Change History

Changed 5 years ago by hopscc

These names are skipped currently because they are .Net core class methods with multiple overloads that cobra does not correctly resolve wrt C#.

A first step to addressing this might be to remove the if-guard, run the tests and work through addressing any problems encountered....

( any C# specific resolutions need to be pushed into backend processing)

More refs to info on overload resolution (C#/.Net) on ticket:130

Changed 5 years ago by Charles

Also, more tests may be needed for each method. The guard isn't just for the current tests, but also for their use in the Cobra.Core and the compiler (although the latter is now a test).

Changed 4 years ago by hopscc

Similar issue is root cause of ticket:323.
Though that is a real edge case: casting away type of arg and try and auto determine best overload...

Note: See TracTickets for help on using tickets.