2009-11-26 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / mcs / compiler.doc
index 9c9eb49d9242903a8921cc054734053fa56d270e..952437601c0800e97b3c4d2767e05f2779a26993 100644 (file)
@@ -87,3 +87,30 @@ The compiler has a number of phases:
 
 * Expressions
 
+* Error reporting
+
+       Always use `Report::Error' or `Report::Warning' methods of Report
+       class. The actual Report instance is available via local context.
+       An expression error reporting has to be done during Resolve phase,
+       except when it's Emit specific (very rare).
+
+       Error reporting should try to use the same codes that the
+       Microsoft compiler uses (if only so we can track which errors
+       we handle and which ones we dont).
+
+       If there is an error which is specific to MSC, use negative
+       numbers, and register the number in mcs/errors/errors.txt
+
+       Try to write a test case for any error that you run into the
+       code of the compiler if there is none already.
+
+       Put your test case in a file called csNNNN.cs in the
+       mcs/errors directory, and have the first two lines be:
+
+       // csNNNN.cs: This is the error message
+       // Line: XXX
+       // Compiler options: an optional compiler options
+
+       Where `XXX' is the line where the error ocurrs.  We will later
+       use this as a regression test suite for catching errors in the
+       compiler.