Bug 14633 - Resolver shouldn't use private extensions methods
Summary: Resolver shouldn't use private extensions methods
Status: RESOLVED UPSTREAM
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Windows
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-09-11 04:02 UTC by Lopatkin Ilja
Modified: 2013-09-12 04:05 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description Lopatkin Ilja 2013-09-11 04:02:25 UTC
Let's say we have a following code:

namespace Foo {
    public static class FooExtensions {
        static T Extension<T>(this object value) {
            return default(T);
        }
    }
}

namespace Bar {
    using System.Collections.Generic;

    public static class BarExtensions {
        public static IEnumerable<T> Extension<T>(this object value) {
            return new T[0];
        }
    }
}

namespace Bazz {
    using Foo;
    using Bar;

    public class Client {
        public void Method() {
            foreach (var foo in new object().Extension<int>())
                Console.WriteLine(foo);
        }
    }
}

In that case completion works fine and offers only the one Extension method which is the public method from BarExtensions. But at the same time resolver can't determine the type of foo variable because he thinks it's a method from FooExtensions and int type doesn't have GetEnumerator method.
Comment 1 Mike Krüger 2013-09-12 04:05:38 UTC
I reported the bug upstream (https://github.com/icsharpcode/NRefactory/issues/331)