• S
    Fixes extension method error reporting for the following issue. · 2c899e44
    shyamn 提交于
    interface I
    {
    static void M(this object o);
    }
    
    Result:
    (3,17): error CS0106: The modifier 'static' is not valid for this item
    (3,17): error CS1105: Extension methods must be static
    
    Expected:
    (3,17): error CS0106: The modifier 'static' is not valid for this item
    (3,17): error CS1106: Extension method must be defined in a non-generic static class
    
    The fix was simple - I simply switched the order in which the above extension method errors are reported. However, this has a small side-effect in that it changes the error reporting for the following case. The change seems acceptable (i.e. user would anyways have hit the new error that we report now as soon as they fixed the error that the old compiler was reporting in this case). I've fixed up the couple of tests that were validating the old error for this case.
    
    class C
    {
    void M(this object o) { }
    }
    
    Old (Native as well as Roslyn):
    Test.cs(3,10): error CS1105: Extension method must be static
    
    New:
    Test.cs(1,7): error CS1106: Extension method must be defined in a non-generic static class (changeset 1250408)
    2c899e44
BindingTests.cs 59.5 KB