Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=81350 --- shadow/81350 2007-04-10 20:36:31.000000000 -0400 +++ shadow/81350.tmp.15037 2007-04-10 20:36:31.000000000 -0400 @@ -0,0 +1,53 @@ +Bug#: 81350 +Product: Mono: Compilers +Version: 1.2 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: non-public extension method problems + +A non-public extension method gives several problems: + +1) when it's called in the ``oldfashioned'' way, it gives very +strange/wrong error messages (compared to the non-extension method +2) when it's called in the extension method way it generates invalid IL code + +sample file: + +using System; + +static class Program{ + + static void Main(string[] args) + { + string s = "Hello, world"; + //compiles to nonworking il code: + s.Print(); + + //gives an incomprehensible error and an incorrect error: + //error CS0119: Expression denotes a `type', where a `variable', +`value' or `method group' was expected <-- wtf? + //Ext.cs(14,13): error CS1501: No overload for method `Print' takes `2' +arguments <-- it takes one argument from a linq point of few, also can a +class be a ``this'' parameter? + Foo.Print(s); + } + +} + +//the problem is that Print is not public +//this class gives either an incomprehensible error or generates wrong il code +static class Foo{static void Print(this string s){Console.WriteLine(s);}} + +// the following implemtation gives a normal error: +// static class Foo{static void Print(string s){Console.WriteLine(s);}} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
