diff options
author | Jaime Anguiano Olarra <jaime@mono-cvs.ximian.com> | 2002-11-30 22:15:59 +0300 |
---|---|---|
committer | Jaime Anguiano Olarra <jaime@mono-cvs.ximian.com> | 2002-11-30 22:15:59 +0300 |
commit | 156cf2e732ab6675c386e9be1cbf3125bc762343 (patch) | |
tree | 2971297dda4fe5668f03e0a30421eed906e951b9 /mcs/errors/cs0027-2.cs | |
parent | d735632a9efcdc38484bd1a157b12e419bdf46b2 (diff) |
2nd Test for Error CS0027. In this case compile complains only of CS0026.
svn path=/trunk/mcs/; revision=9291
Diffstat (limited to 'mcs/errors/cs0027-2.cs')
-rw-r--r-- | mcs/errors/cs0027-2.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mcs/errors/cs0027-2.cs b/mcs/errors/cs0027-2.cs new file mode 100644 index 00000000000..d1af6ef887e --- /dev/null +++ b/mcs/errors/cs0027-2.cs @@ -0,0 +1,18 @@ +// cs0027-2.cs: Keyword 'this' can't be used outside a constructor, a method or a property. +// Line: 10 + +// Attention: Here the compiler complains saying that cannot convert implicitly from 'Error0027' to 'int' but +// should also say that the use of keyword 'this' is out of context since it's used outside a constructor, method +// or property. +using System; + +class Error0027 { + int i = this; + int x = 0; + + public static void Main () { + Console.WriteLine ("The compiler should complain: Error CS0027 trying to use 'this' outside context."); + Console.WriteLine ("Trying to assign i to 'this' outside a method, property or ctr."); + } +} + |