Author: raja
Date: 2005-04-01 07:54:27 -0500 (Fri, 01 Apr 2005)
New Revision: 42459
Added:
trunk/mcs/errors/cs0267.cs
trunk/mcs/tests/test-359.cs
Modified:
trunk/mcs/errors/ChangeLog
trunk/mcs/errors/gmcs-expect-wrong-error
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/cs-parser.jay
trunk/mcs/mcs/cs-tokenizer.cs
trunk/mcs/mcs/rootcontext.cs
trunk/mcs/tests/ChangeLog
trunk/mcs/tests/Makefile
Log:
In mcs:
* cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
keyword in 'partial enum' too.
* cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
is not allowed).
Report from Kamil Skalski <[EMAIL PROTECTED]>.
Fix #74309.
* rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
have partial containers too.
In tests:
* test-359.cs: New test from #74309.
In errors:
* cs0267.cs: New. Mentioned in passing in #74309.
Modified: trunk/mcs/errors/ChangeLog
===================================================================
--- trunk/mcs/errors/ChangeLog 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/errors/ChangeLog 2005-04-01 12:54:27 UTC (rev 42459)
@@ -1,3 +1,7 @@
+2005-04-01 Raja R Harinath <[EMAIL PROTECTED]>
+
+ * cs0267.cs: New. Mentioned in passing in #74309.
+
2005-03-29 Raja R Harinath <[EMAIL PROTECTED]>
* cs0136-3.cs, cs0136-4.cs: New tests from #47991.
Added: trunk/mcs/errors/cs0267.cs
===================================================================
--- trunk/mcs/errors/cs0267.cs 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/errors/cs0267.cs 2005-04-01 12:54:27 UTC (rev 42459)
@@ -0,0 +1 @@
+partial enum e {}
Modified: trunk/mcs/errors/gmcs-expect-wrong-error
===================================================================
--- trunk/mcs/errors/gmcs-expect-wrong-error 2005-04-01 12:52:03 UTC (rev
42458)
+++ trunk/mcs/errors/gmcs-expect-wrong-error 2005-04-01 12:54:27 UTC (rev
42459)
@@ -34,6 +34,7 @@
cs0257.cs # new in GMCS
cs0266-3.cs
cs0266.cs
+cs0267.cs
cs0269.cs
cs0271.cs
cs0272.cs
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/mcs/ChangeLog 2005-04-01 12:54:27 UTC (rev 42459)
@@ -1,5 +1,15 @@
2005-04-01 Raja R Harinath <[EMAIL PROTECTED]>
+ * cs-tokenizer.cs (consume_identifier): Treat 'partial' as a
+ keyword in 'partial enum' too.
+ * cs-parser.jay (enum_declaration): Add CS0267 check ('partial enum'
+ is not allowed).
+ Report from Kamil Skalski <[EMAIL PROTECTED]>.
+
+ Fix #74309.
+ * rootcontext.cs (ResolveTree): The 'root.Interfaces' list can
+ have partial containers too.
+
* ecore.cs (SimpleName.SimpleNameResolve): Move 'invariant meaning
in block' checks to Block.CheckInvariantMeaningInBlock.
* statement.cs (Block.GetKnownVariableInfo): Make private.
Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/mcs/cs-parser.jay 2005-04-01 12:54:27 UTC (rev 42459)
@@ -2275,6 +2275,7 @@
enum_declaration
: opt_attributes
opt_modifiers
+ opt_partial
ENUM IDENTIFIER
opt_enum_base {
if (RootContext.Documentation != null)
@@ -2282,17 +2283,24 @@
}
enum_body
opt_semicolon
- {
+ {
+ bool partial = (bool) $3;
+
+ if (partial) {
+ Report.Error (267, lexer.Location, "The partial
modifier can only appear before a 'class', 'struct', or 'interface'");
+ break; // assumes that the parser put us in a switch
+ }
+
Location enum_location = lexer.Location;
- MemberName name = MakeName (new MemberName ((string) $4));
- Enum e = new Enum (current_namespace, current_class,
(Expression) $5, (int) $2,
+ MemberName name = MakeName (new MemberName ((string) $5));
+ Enum e = new Enum (current_namespace, current_class,
(Expression) $6, (int) $2,
name, (Attributes) $1, enum_location);
if (RootContext.Documentation != null)
e.DocComment = enumTypeComment;
- foreach (VariableDeclaration ev in (ArrayList) $7) {
+ foreach (VariableDeclaration ev in (ArrayList) $8) {
e.AddEnumMember (ev.identifier,
(Expression)
ev.expression_or_array_initializer,
ev.Location, ev.OptAttributes,
Modified: trunk/mcs/mcs/cs-tokenizer.cs
===================================================================
--- trunk/mcs/mcs/cs-tokenizer.cs 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/mcs/cs-tokenizer.cs 2005-04-01 12:54:27 UTC (rev 42459)
@@ -1811,7 +1811,8 @@
int next_token = token ();
bool ok = (next_token == Token.CLASS) ||
(next_token == Token.STRUCT) ||
- (next_token == Token.INTERFACE);
+ (next_token == Token.INTERFACE) ||
+ (next_token == Token.ENUM); //
"partial" is a keyword in 'partial enum', even though it's not valid
reader.Position = old;
putback_char = old_putback;
Modified: trunk/mcs/mcs/rootcontext.cs
===================================================================
--- trunk/mcs/mcs/rootcontext.cs 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/mcs/rootcontext.cs 2005-04-01 12:54:27 UTC (rev 42459)
@@ -163,7 +163,7 @@
ArrayList ifaces = root.Interfaces;
if (ifaces != null){
- foreach (Interface i in ifaces)
+ foreach (TypeContainer i in ifaces)
i.DefineType ();
}
Modified: trunk/mcs/tests/ChangeLog
===================================================================
--- trunk/mcs/tests/ChangeLog 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/tests/ChangeLog 2005-04-01 12:54:27 UTC (rev 42459)
@@ -1,6 +1,10 @@
+2005-04-01 Kamil Skalski <[EMAIL PROTECTED]>
+
+ * test-359.cs: New test from #74309.
+
2005-03-30 Marek Safar <[EMAIL PROTECTED]>
- * cond-attr.cs.cs: Conditional attribute class test.
+ * cond-attr.cs: Conditional attribute class test.
2005-03-16 Raja R Harinath <[EMAIL PROTECTED]>
Modified: trunk/mcs/tests/Makefile
===================================================================
--- trunk/mcs/tests/Makefile 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/tests/Makefile 2005-04-01 12:54:27 UTC (rev 42459)
@@ -31,7 +31,7 @@
NEW_TEST_SOURCES_common = xml-033 xml-034 xml-035 xml-036 test-329 2test-16
test-330 a-parameter5 test-331 test-332 \
test-333 test-311 test-335 test-336 test-337 test-287
test-338 test-339 test-341 test-334 test-342 \
test-344 test-345 test-346 test-347 test-348 test-349
test-350 test-351 test-352 test-353 test-354 test-355 \
- test-356 test-357 test-358 \
+ test-356 test-357 test-358 test-359 \
mtest-7-dll mtest-7-exe
#
Added: trunk/mcs/tests/test-359.cs
===================================================================
--- trunk/mcs/tests/test-359.cs 2005-04-01 12:52:03 UTC (rev 42458)
+++ trunk/mcs/tests/test-359.cs 2005-04-01 12:54:27 UTC (rev 42459)
@@ -0,0 +1,14 @@
+partial interface B {
+ void foo ();
+}
+
+partial interface B {
+ void faa ();
+}
+
+public class Test
+{
+ public static void Main ()
+ {
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches