From 8e5062c1bc56ea72855b4dc2f221b86ff30d5c3a Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 12 Oct 2007 17:11:00 +0000 Subject: [PATCH] New tests + update svn path=/trunk/mcs/; revision=87408 --- mcs/errors/cs0206.cs | 5 +++-- mcs/errors/gcs0037-2.cs | 21 +++++++++++++++++++++ mcs/errors/gcs0206.cs | 17 +++++++++++++++++ mcs/errors/gcs1501-2.cs | 29 +++++++++++++++++++++++++++++ mcs/errors/gcs1939.cs | 21 +++++++++++++++++++++ mcs/errors/gcs1942-2.cs | 21 +++++++++++++++++++++ mcs/errors/gcs1942.cs | 15 +++++++++++++++ 7 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 mcs/errors/gcs0037-2.cs create mode 100644 mcs/errors/gcs0206.cs create mode 100644 mcs/errors/gcs1501-2.cs create mode 100644 mcs/errors/gcs1939.cs create mode 100644 mcs/errors/gcs1942-2.cs create mode 100644 mcs/errors/gcs1942.cs diff --git a/mcs/errors/cs0206.cs b/mcs/errors/cs0206.cs index 3fe60407e6a..db0450affb3 100644 --- a/mcs/errors/cs0206.cs +++ b/mcs/errors/cs0206.cs @@ -1,5 +1,6 @@ -// cs0206.cs: A property or indexer `X.P' may not be passed as an out or ref parameter -// Line: +// CS0206: A property or indexer `X.P' may not be passed as `ref' or `out' parameter +// Line: 15 + class X { static int P { get { return 1; } set { } } diff --git a/mcs/errors/gcs0037-2.cs b/mcs/errors/gcs0037-2.cs new file mode 100644 index 00000000000..ba1b1d5c18f --- /dev/null +++ b/mcs/errors/gcs0037-2.cs @@ -0,0 +1,21 @@ +// CS0037: Cannot convert null to `bool' because it is a value type +// Line: 19 +// Compiler options: -langversion:linq + +using System; + +class TestA +{ + public string Select (Func f) + { + return ""; + } +} + +public class C +{ + static void Main () + { + string foo = from a in new TestA () select null; + } +} diff --git a/mcs/errors/gcs0206.cs b/mcs/errors/gcs0206.cs new file mode 100644 index 00000000000..241f21b5ae8 --- /dev/null +++ b/mcs/errors/gcs0206.cs @@ -0,0 +1,17 @@ +// CS0206: A property or indexer `anonymous type.Foo' may not be passed as `ref' or `out' parameter +// Line: 14 +// Compiler options: -langversion:linq + +class C +{ + static void Foo (ref object o) + { + } + + public static void Main () + { + var v = new { Foo = "Bar" }; + + Foo (ref v.Foo); + } +} diff --git a/mcs/errors/gcs1501-2.cs b/mcs/errors/gcs1501-2.cs new file mode 100644 index 00000000000..920afc0e6df --- /dev/null +++ b/mcs/errors/gcs1501-2.cs @@ -0,0 +1,29 @@ +// CS1501: No overload for method `Select' takes `1' arguments +// Line: 17 +// Compiler options: -langversion:linq + +using System; + +class TestA +{ + public string value; + + public TestA (string value) + { + this.value = value; + } + + public string Select (int i, Func f) + { + return value; + } +} + +public class M +{ + static void Main () + { + var v = new TestA ("Oh yes"); + string foo = from a in v select a; + } +} diff --git a/mcs/errors/gcs1939.cs b/mcs/errors/gcs1939.cs new file mode 100644 index 00000000000..5a60ec3ae4d --- /dev/null +++ b/mcs/errors/gcs1939.cs @@ -0,0 +1,21 @@ +// CS1930: A range variable `v' may not be passes as `ref' or `out' parameter +// Line: 19 +// Compiler options: -langversion:linq + +using System; +using System.Linq; + +class C +{ + static int Foo (ref int value) + { + return 1; + } + + public static void Main () + { + var e = from v in "a" + let r = 1 + select Foo (ref v); + } +} diff --git a/mcs/errors/gcs1942-2.cs b/mcs/errors/gcs1942-2.cs new file mode 100644 index 00000000000..0ea535c61fe --- /dev/null +++ b/mcs/errors/gcs1942-2.cs @@ -0,0 +1,21 @@ +// CS1942: Type inference failed to infer type argument for `select' clause. Try specifying the type argument explicitly +// Line: +// Compiler options: -langversion:linq + +using System; + +class TestA +{ + public string Select (Func f) + { + return ""; + } +} + +public class C +{ + static void Main () + { + string foo = from a in new TestA () select null; + } +} diff --git a/mcs/errors/gcs1942.cs b/mcs/errors/gcs1942.cs new file mode 100644 index 00000000000..25ca691bd00 --- /dev/null +++ b/mcs/errors/gcs1942.cs @@ -0,0 +1,15 @@ +// CS1942: Type inference failed to infer type argument for `select' clause. Try specifying the type argument explicitly +// Line: 13 +// Compiler options: -langversion:linq + +using System; +using System.Linq; + +class C +{ + public static void Main () + { + var e = from values in "abcd" + select null; + } +} -- 2.25.1