Skip to content

Commit

Permalink
New tests.
Browse files Browse the repository at this point in the history
svn path=/trunk/mcs/; revision=157426
  • Loading branch information
marek-safar committed May 17, 2010
2 parents f06ff7c + 36ba81c commit c858c7f
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 14 deletions.
45 changes: 32 additions & 13 deletions mcs/errors/cs0038-2.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
// cs0038-2.cs: Cannot access a nonstatic member of outer type `X' via nested type `X.Nested'
// Line: 9
public enum MyEnum { V = 1 }
// CS0038: Cannot access a nonstatic member of outer type `Outer' via nested type `Outer.Inner'
// Line: 33

class X {
public MyEnum MyEnum;
class Nested {
internal MyEnum D () {
return MyEnum;
}
public class Runner
{
string msg;

public Runner (string s)
{
msg = s;
}

public string Report ()
{
return msg;
}
}

public class Outer
{
private Runner r = new Runner ("Outer");

public Runner Runner
{
get { return r; }
set { r = value; }
}

static int Main () {
Nested n = new Nested ();
return n.D() == MyEnum.V ? 0 : 1;

class Inner
{
public string Check ()
{
return Runner.Report ();
}
}
}
2 changes: 1 addition & 1 deletion mcs/errors/cs0120-15.cs → mcs/errors/cs0119-9.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CS0120: An object reference is required to access non-static member `C.Enum()'
// CS0119: Expression denotes a `method group', where a `variable', `value' or `type' was expected
// Line: 20

using System;
Expand Down
22 changes: 22 additions & 0 deletions mcs/errors/cs0120-16.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// CS0120: An object reference is required to access non-static member `App.Test'
// Line: 15

class App
{
Test a = new Test ();

public Test Test
{
get { return a; }
}

public static void Main (string[] args)
{
Test.Run ();
}
}

class Test
{
public void Run () { }
}
16 changes: 16 additions & 0 deletions mcs/errors/cs0171-3.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// CS0171: Field `S<TKey>.key' must be fully assigned before control leaves the constructor
// Line: 13

public struct S<TKey> {
private TKey key;

public TKey Key {
get { return key; }
private set { key = value; }
}

public S (TKey key)
{
Key = key;
}
}
13 changes: 13 additions & 0 deletions mcs/errors/cs0214-14.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// CS0214: Pointers and fixed size buffers may only be used in an unsafe context
// Line: 11
// Compiler options: -unsafe

public class C
{
unsafe int* i;

public static void Main ()
{
var v = new C().i;
}
}
19 changes: 19 additions & 0 deletions mcs/errors/cs1061-3.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// CS1061: Type `object' does not contain a definition for `Test' and no extension method `Test' of type `object' could be found (are you missing a using directive or an assembly reference?)
// Line: 17

public class S
{
public static void Test()
{
}
}

public class M
{
public object S { get; set; }

public void Main ()
{
S.Test ();
}
}

0 comments on commit c858c7f

Please sign in to comment.