2007-11-08 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Thu, 8 Nov 2007 15:02:59 +0000 (15:02 -0000)
committerMarek Safar <marek.safar@gmail.com>
Thu, 8 Nov 2007 15:02:59 +0000 (15:02 -0000)
  A test for bug #335594

svn path=/trunk/mcs/; revision=89194

mcs/tests/test-599.cs [new file with mode: 0644]
mcs/tests/test-77.cs

diff --git a/mcs/tests/test-599.cs b/mcs/tests/test-599.cs
new file mode 100644 (file)
index 0000000..034f6d9
--- /dev/null
@@ -0,0 +1,50 @@
+using System;
+
+namespace Test
+{
+       using Text = System.Text;
+       using Str = System.String;
+       
+       public class String
+       {
+               string s;
+               public String(string s)
+               {
+                       this.s=s;
+               }
+
+               public static implicit operator String (string s1) 
+               {
+                       if(s1==null) return null;
+                       return new String(s1);
+               }
+
+               public static implicit operator Str (String s1) 
+               {
+                       if(s1==null) return null;
+                       return s1.ToString();
+               }
+       }
+}
+
+namespace TestCompiler
+{
+       using String=Test.String;
+       
+       class MainClass
+       {
+               public static int Main ()
+               {
+                       String a = "a";
+                       int i=1;
+                       a+=i;
+                       string s = i + a;
+                       
+                       Console.WriteLine (s);
+                       if (s != "1Test.String")
+                               return 1;
+                               
+                       return 0;
+               }
+       }
+}
index 8f3119b2a88379c433b525ab876e5e93db26ed42..eb78c9ff59c5cb6f3afcec2a07b7d05f93c69897 100644 (file)
@@ -34,6 +34,12 @@ class XX {
                if ((1 + " " + "hello") != "1 hello")
                        return 7;
        
+               const string s1 = null + (string)null;
+               const string s2 = (string)null + null;
+               
+               // csc does not compile this one
+               const string s3 = null + null;  
+       
                System.Console.WriteLine ("test ok");
                return 0;
        }