-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
svn path=/trunk/mcs/; revision=157426
- Loading branch information
Showing
6 changed files
with
103 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 () { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (); | ||
} | ||
} |