mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 17:02:10 -10:00
First cut of the qualified-alias-member feature. * cs-tokenizer.cs (Tokenizer.is_punct): Recognize the double-colon token. * cs-parser.jay (DOUBLE_COLON): New token. (namespace_or_type_name): Add rule for recognizing qualified-alias-members. (primary_expression): Likewise. (element_access): Allow QualifiedAliasMember as a possible type-bearing expression. (local_variable_type, local_variable_pointer_type): Likewise. * namespace.cs (NamespaceEntry.LookupAlias): New. Looks up aliases in the current and enclosing namespace declarations. (NamespaceEntry.UsingAlias): Add CS0440 warning. * decl.cs (MemberName.is_double_colon): New. (MemberName.MemberName): Add new constructor for alias-member. (MemberName.GetTypeExpression): Generate QualifiedAliasMember too. * expression.cs (QualifiedAliasMember): New expression type. In errors: * cs0431.cs, cs0432.cs, cs0432-2.cs, cs0440.cs, cs0687.cs: New tests for the qualified-alias-member (::) feature. In tests: * test-426.cs, test-427.cs, test-428.cs, test-429.cs, test-430.cs, test-431.cs, test-432.cs, test-433.cs, test-434.cs, test-435.cs, test-436.cs: New tests for the qualified-alias-member (::) feature. svn path=/trunk/mcs/; revision=47931
20 lines
352 B
C#
20 lines
352 B
C#
// cs0440.cs: An alias named `global' will not be used when resolving 'global::'; the global namespace will be used instead
|
|
// Line: 5
|
|
// Compiler options: -warn:2 -warnaserror
|
|
|
|
using global = Foo;
|
|
|
|
namespace Foo {
|
|
class A { }
|
|
}
|
|
|
|
class A { }
|
|
|
|
class X {
|
|
static void Main ()
|
|
{
|
|
A a = new global::A ();
|
|
System.Console.WriteLine (a.GetType ());
|
|
}
|
|
}
|