[nem-en] Macros and extension methods
vc
vc at rsdn.ru
Sat Jun 10 14:20:01 CEST 2006
> The problem is that typer searches for ALL extension methods available
> on ANY types. It puts them into the list of available overloads. It
> probably filters them later, during overload resolution, but I didn't
> tracked where it happens yet (a hint from Michal woud be useful).
>
> So when I enabled this feature, all the completion results had the
> matching extension methods from NString, NArray, etc. Of course it
> doesn't work correctly even now - if you try something like
Hm... The error not in commented code.
If try complete this:
try_completion ("def arr = array['1', '2']; arr.Fold('0', (_, _) =>
'3').Map");
You get same result:
Trying to complete: 'def arr = array['1', '2']; arr.Fold('0', (_, _) =>
'3').Map'
Type of the member: System.Char
Member found:
Map ==> method Nemerle.Utility.NArray.Map(ar : array ['a.723], f :
'a.723 -> 'b.724) : array ['b.724] Public, Static
Map ==> method Nemerle.Utility.NString.Map(s : string, f : char ->
char) : string Public, Static
I think, the solver has not calculated exact match.
I think, it is a *compiler* bug. If try compile this example:
using System.Console;
using Nemerle.Utility;
def arr = array['1', '2'];
def x = arr.Fold('0', (_, _) => '3').Map;
WriteLine(x)
You get message:
====================================
Main.n(5,9,5,41): error : typing fails on ambiguity between overloads:
====================================
The list of overloads is empty, but in this sample no overloads!
And this example:
using System.Console;
using Nemerle.Utility;
def arr = array['1', '2'];
def x = arr.Fold('0', (_, _) => '3').MapCS;
WriteLine(x)
compile correctly! But in array no exists MapCS extension method.
Vlad
More information about the devel-en
mailing list