-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mcs] Consider nested types when looking for potential types via usin…
…g static. Fixes #29044
- Loading branch information
1 parent
8fad4b7
commit 322af7e
Showing
6 changed files
with
202 additions
and
21 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// CS0104: `N' is an ambiguous reference between `C.N' and `A.T.N' | ||
// Line: 32 | ||
|
||
namespace A | ||
{ | ||
public class T | ||
{ | ||
public class N | ||
{ | ||
|
||
} | ||
} | ||
} | ||
|
||
namespace C | ||
{ | ||
struct N | ||
{ | ||
|
||
} | ||
} | ||
|
||
namespace B | ||
{ | ||
using static A.T; | ||
using C; | ||
|
||
static class Program | ||
{ | ||
static void Main () | ||
{ | ||
var u = new N (); | ||
} | ||
} | ||
} |
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,23 @@ | ||
// CS0246: The type or namespace name `B' could not be found. Are you missing an assembly reference? | ||
// Line: 21 | ||
|
||
using static A; | ||
|
||
class A : B | ||
{ | ||
} | ||
|
||
class P | ||
{ | ||
public class N<T> | ||
{ | ||
} | ||
} | ||
|
||
class Test | ||
{ | ||
public static void Main () | ||
{ | ||
var n = default (N<int>); | ||
} | ||
} |
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,17 @@ | ||
using static A; | ||
//using N = System.Int32; | ||
|
||
class A | ||
{ | ||
public class N | ||
{ | ||
} | ||
} | ||
|
||
class Test | ||
{ | ||
public static void Main () | ||
{ | ||
N n = default (N); // Am I Int32 or A.N | ||
} | ||
} |
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,24 @@ | ||
namespace A | ||
{ | ||
public class T | ||
{ | ||
public class N | ||
{ | ||
|
||
} | ||
} | ||
} | ||
|
||
namespace B | ||
{ | ||
using static A.T; | ||
|
||
static class Program | ||
{ | ||
static void Main () | ||
{ | ||
var t = typeof (N); | ||
var u = new N (); | ||
} | ||
} | ||
} |
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