[svn] r6026: nemerle/trunk/ncc: hierarchy/TypeBuilder.n
testsuite/frommcs/test-partial-08.n testsuite/from...
nazgul
svnadmin at nemerle.org
Mon Dec 19 22:05:24 CET 2005
Log:
Allow abstract and sealed to be specified only on one part of class
Author: nazgul
Date: Mon Dec 19 22:05:06 2005
New Revision: 6026
Added:
nemerle/trunk/ncc/testsuite/frommcs/test-partial-08.n (contents, props changed)
nemerle/trunk/ncc/testsuite/frommcs/test-partial-09.n (contents, props changed)
Modified:
nemerle/trunk/ncc/hierarchy/TypeBuilder.n
Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n (original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n Mon Dec 19 22:05:06 2005
@@ -1319,6 +1319,10 @@
| null => additional.Attributes |= NemerleAttributes.Internal;
| _ => additional.Attributes |= NemerleAttributes.Private;
}
+ // we allow abstract and sealed to be specified just on one arbitratry part
+ attributes |= additional.Attributes & (NemerleAttributes.Abstract | NemerleAttributes.Sealed);
+ additional.Attributes |= attributes & (NemerleAttributes.Abstract | NemerleAttributes.Sealed);
+
when (additional.Attributes != attributes)
Message.Error (additional.loc, $"joined partial classes `$(FullName)' "
"must have compatible modifiers");
Added: nemerle/trunk/ncc/testsuite/frommcs/test-partial-08.n
==============================================================================
--- (empty file)
+++ nemerle/trunk/ncc/testsuite/frommcs/test-partial-08.n Mon Dec 19 22:05:06 2005
@@ -0,0 +1,21 @@
+// The standard says this doesn't have to have the 'sealed' modifier
+public partial class Foo
+{
+ public mutable myId : string;
+}
+
+public sealed partial class Foo
+{
+ public Id : string { get { myId; } }
+}
+
+public class PartialAbstractCompilationError
+{
+ public static Main () : void
+ {
+ when (typeof (Foo).IsAbstract || !typeof (Foo).IsSealed)
+ throw System.ApplicationException ();
+ }
+}
+
+
Added: nemerle/trunk/ncc/testsuite/frommcs/test-partial-09.n
==============================================================================
--- (empty file)
+++ nemerle/trunk/ncc/testsuite/frommcs/test-partial-09.n Mon Dec 19 22:05:06 2005
@@ -0,0 +1,25 @@
+// The standard says this doesn't have to have the 'abstract' modifier
+public partial class Foo
+{
+ public mutable myId : string;
+}
+
+public abstract partial class Foo
+{
+ public Id : string { get { myId; } }
+}
+
+public class Bar : Foo
+{
+ public this (mutable id : string) { myId = id; }
+}
+
+public class PartialAbstractCompilationError
+{
+ public static Main () : void
+ {
+ System.Console.WriteLine (typeof (Foo).IsAbstract);
+ }
+}
+
+
More information about the svn
mailing list