[Mono-list] [PATCH] "protected internal" semantics

Jaroslaw Kowalski jarek@atm.com.pl
Sun, 15 Dec 2002 22:52:32 +0100


I just wanted to compile large part of my code with MCS and found this
problem, so I've made some investigation to fix it.

Yes, the patch is supposed to make MCS more compliant with CSC's behaviour
by disallowing some invalid code to compile and preventing some invalid
error message.

After patch a1.cs and b1.cs should fail to compile while a0.cs and b0.cs
should compile just fine.

I hope that the patch doesn't break any existing code ;-)

Jarek
----- Original Message -----
From: "Miguel de Icaza" <miguel@ximian.com>
To: "Jaroslaw Kowalski" <jarek@atm.com.pl>
Cc: <mono-list@ximian.com>
Sent: Sunday, December 15, 2002 9:54 AM
Subject: Re: [Mono-list] [PATCH] "protected internal" semantics


> Hello,
>
> > Today I've reported an MCS error where it wasn't possible to override
> > "protected internal" method with method declared as "protected" in
another
> > assembly.
> >
> > Here's my attempt to fix it: I've added some conditions in "decl.cs"
(patch
> > included) and some mini test to check this functionality (second and
fourth
> > compilations should fail under both mcs and csc)
> >
> > Can you please verify the patch and commit if it's ok (I'm using
read-only
> > CVS access)
>
> I ran your test, and tried to compile it with CSC, and CSC reported:
>
> a1.cs(11,26): error CS0507:'C.Test1()': cannot change access modifiers
when overriding 'protected internal' inherited member 'A.Test1()'
> a1.cs(3,35): (Location of symbol related to previous error)
> b1.cs(3,35): error CS0507:'B0.Test1()': cannot change access modifiers
when overriding 'protected' inherited member 'A.Test1()'
> a0.dll:         (Location of symbol related to previous error)
>
> When compiled with MCS I got:
>
> ^Pmono$ mcs /t:library a1.cs
> a1.cs(11) error CS0507: `C.Test1': can't change the access modifiers
> when overriding inherited member `A.Test1'
> Compilation failed: 1 error(s), 0 warnings
> mono$ mcs /r:a0.dll /t:library b0.cs
> b0.cs(3) error CS0507: `B1.Test1': can't change the access modifiers
> when overriding inherited member `A.Test1'
> Compilation failed: 1 error(s), 0 warnings
> mono$ mcs /r:a0.dll /t:library b1.cs
> Block is: 65552
> Compilation succeeded
>
> Does your patch move us to compliancy with CSC?  It seems like it would,
> but I want to confirm that ;-)
>
> Miguel
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>