PATCH: Accessor bug in nested types fixed!

0 views
Skip to first unread message

emp...@gmail.com

unread,
Jun 28, 2009, 2:03:10 PM6/28/09
to Nemerle Forum
Hello,

The following code should normally compiled successfully but Nemerle
fails with "less accessable" error:

class Foo
{
protected class Bar
{
public foo:Foo;
}

public static Main():void
{
System.Console.WriteLine ("OK")
}
}


The main issue was public is valid for foo even Bar can be protected.
Nested types can fully access DeclaredTypes regardless their
accessors.

The patch is here :
http://nemerle-en.googlegroups.com/web/nested-type-accessor.patch?gda=gRRT2UwAAACGzRgjTni500XnDJr-h-B3KtfFqps8totNUKY7TmIHVoaAmEDvU69xO3Wm5aPvBOY87liJksFjX1CiEYtCtS3E_Vpvmo5s1aABVJRO3P3wLQ&gsc=t_e9mgsAAAAQugyWbvTNXv5857-pnYo0

Please review and commit.

P.S: Can I get SVN access ? What should do for it ?

Dmitry Ivankov

unread,
Jul 3, 2009, 6:17:57 AM7/3/09
to nemer...@googlegroups.com
Hi

On Mon, Jun 29, 2009 at 12:03 AM, emp...@gmail.com <emp...@gmail.com> wrote:

Hello,

The following code should normally compiled successfully but Nemerle
fails with "less accessable" error:

class Foo
{
       protected class Bar
       {
         public foo:Foo;
       }

   public static Main():void
   {
       System.Console.WriteLine ("OK")
    }
}


The main issue was public is valid for foo even Bar can be protected.
Nested types can fully access DeclaredTypes regardless their
accessors.

The patch is here :
http://nemerle-en.googlegroups.com/web/nested-type-accessor.patch?gda=gRRT2UwAAACGzRgjTni500XnDJr-h-B3KtfFqps8totNUKY7TmIHVoaAmEDvU69xO3Wm5aPvBOY87liJksFjX1CiEYtCtS3E_Vpvmo5s1aABVJRO3P3wLQ&gsc=t_e9mgsAAAAQugyWbvTNXv5857-pnYo0
There is an obvious bug in it, which even should be reported by the compiler - matchcase tc doesn't check the equality of the matched thing and tc and thus unused third match case.
As for the main issue I'll need a bit of time to browse the ecma and check the current behaviour. Quite strange that there is a plenty of tests ported from gmcs, but this issue isn't covered by them.

ReverseBlade

unread,
Jul 3, 2009, 6:33:15 AM7/3/09
to Nemerle Forum
Stupid me! Yeah you are right, well still I make the same mistake all
over again. tc is not a variant.
I will update the patch and revert that line to | tc' when
tc'.Equals(tc) => true; or may be a to a simple if-else if -else

For the main issue, I haven't checked the specs, but I compared to
code with C#. C# compiles the equivalent successfully.

Thanks for looking into this


On Jul 3, 1:17 pm, Dmitry Ivankov <divanor...@gmail.com> wrote:
> Hibe
>
> On Mon, Jun 29, 2009 at 12:03 AM, empe...@gmail.com <empe...@gmail.com>wrote:
>
>
>
>
>
> > Hello,
>
> > The following code should normally compiled successfully but Nemerle
> > fails with "less accessable" error:
>
> > class Foo
> > {
> >        protected class Bar
> >        {
> >          public foo:Foo;
> >        }
>
> >    public static Main():void
> >    {
> >        System.Console.WriteLine ("OK")
> >     }
> > }
>
> > The main issue was public is valid for foo even Bar can be protected.
> > Nested types can fully access DeclaredTypes regardless their
> > accessors.
>
> > The patch is here :
>
> >http://nemerle-en.googlegroups.com/web/nested-type-accessor.patch?gda...
Reply all
Reply to author
Forward
0 new messages