[Mono-dev] Random "Internal Compiler Error" with extension methods on interfaces?

Andrés G. Aragoneses knocte at gmail.com
Sun Feb 3 21:02:26 UTC 2013


It doesn't compile with Mono 3.0.x. When I said it doesn't throw an error,
I meant that it doesn't throw an exception (internal compiler error), but
it shows the compiler error you describe (ambiguity). So there's no bug
anymore. Upgrade Mono.

On 3 February 2013 19:36, Jordan Earls <earlz at lastyearswishes.com> wrote:

> I'll attempt that. In the mean time, I uncovered the core underlying
> cause. It doesn't properly detect an ambiguity I had in my code. This
> code shouldn't compile. It should give a compiler error at the `Foo`
> constructors
>
>         public class Foo
>         {
>                 public Foo(int? s=null, string m=null)
>                 {
>                 }
>                 public Foo(string m=null, int? s=null)
>                 {
>                 }
>                 public void Get()
>                 {
>                         throw new NotImplementedException();
>                 }
>         }
>
>         class MainClass
>         {
>                 public static void Main(string[] args)
>                 {
>                         var f=new Foo();
>                         Console.WriteLine("Hello World!");
>                 }
>         }
>
> The fact that this compiled on latest Mono makes me think it's a bug.
> if you replace the `int?` on the Foo constructors with `object`, it'll
> throw a compiler error about ambiguous calls. This actually has
> nothing to do with extension methods. It's the compiler not detecting
> ambiguity where there is some.
>
> On Sun, Feb 3, 2013 at 5:58 AM, Daniel Lo Nigro <lists at dan.cx> wrote:
> > I tried comparing Mono 2.10.8 to 3.0.2 in Github but there's 6,566
> commits
> > between them so it's hard to tell exactly which one fixed it :)
> >
> > If you have time to, you could try a few different Mono versions and
> narrow
> > it down to a release that fixes it. I'd try the last release of 2.10, the
> > first and last (2.11.4) releases of 2.11, and the first release of 3.0.
> It
> > was probably fixed between 2.10 -> 2.11 or 2.11 -> 3.0.
> >
> >
> > On Sun, Feb 3, 2013 at 2:10 PM, Jordan Earls <earlz at lastyearswishes.com>
> > wrote:
> >>
> >> Awesome.. Is there any reports of bugs that could've caused this? I'd
> >> really like to workaround this issue for compatibility reasons with
> >> older versions of mono
> >>
> >> On Sat, Feb 2, 2013 at 9:46 PM, Andres G. Aragoneses <knocte at gmail.com>
> >> wrote:
> >> > On 03/02/13 02:37, Jordan Earls wrote:
> >> >>
> >> >> If anyone wants to see the bug in action, extract
> >> >> http://earlz.net/static/repro.tgz
> >> >
> >> >
> >> > I just tested compiling with Mono 3.0.2 and there is no compiler
> error,
> >> > so
> >> > the bug is fixed in this version.
> >> >
> >> > _______________________________________________
> >> > Mono-devel-list mailing list
> >> > Mono-devel-list at lists.ximian.com
> >> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >> _______________________________________________
> >> Mono-devel-list mailing list
> >> Mono-devel-list at lists.ximian.com
> >> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130203/8c6b01aa/attachment.html>


More information about the Mono-devel-list mailing list