condition tests passes
[mono.git] / mcs / mcs / namespace.cs
index 5f5e13458253c07062c59010252a4ca51fb4bbe1..0861c0c0421cd5e82654a6636ad95f8394e29c8d 100644 (file)
@@ -103,7 +103,7 @@ namespace Mono.CSharp {
                protected void ComputeNamespaces (Assembly assembly)
                {
                        // How to test whether attribute exists without loading the assembly :-(
-#if SMCS_SOURCE
+#if NET_2_1
                        const string SystemCore = "System.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; 
 #else
                        const string SystemCore = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; 
@@ -344,7 +344,7 @@ namespace Mono.CSharp {
                        if (name.IndexOf ('`') > 0) {
                                FullNamedExpression retval = Lookup (ds, SimpleName.RemoveGenericArity (name), loc);
                                if (retval != null) {
-                                       Error_TypeArgumentsCannotBeUsed (retval.Type, loc, "type");
+                                       Error_TypeArgumentsCannotBeUsed (retval.Type, loc);
                                        return;
                                }
                        } else {
@@ -366,11 +366,22 @@ namespace Mono.CSharp {
                                TypeManager.CSharpName(t), TypeManager.GetNumberOfTypeArguments(t).ToString());
                }
 
-               public static void Error_TypeArgumentsCannotBeUsed(Type t, Location loc, string symbol)
+               public static void Error_TypeArgumentsCannotBeUsed (Type t, Location loc)
+               {
+                       Report.SymbolRelatedToPreviousError (t);
+                       Error_TypeArgumentsCannotBeUsed (loc, "type", TypeManager.CSharpName (t));
+               }
+
+               public static void Error_TypeArgumentsCannotBeUsed (MethodBase mi, Location loc)
+               {
+                       Report.SymbolRelatedToPreviousError (mi);
+                       Error_TypeArgumentsCannotBeUsed (loc, "method", TypeManager.CSharpSignature (mi));
+               }
+
+               static void Error_TypeArgumentsCannotBeUsed (Location loc, string type, string name)
                {
-                       Report.SymbolRelatedToPreviousError(t);
                        Report.Error(308, loc, "The non-generic {0} `{1}' cannot be used with the type arguments",
-                               symbol, TypeManager.CSharpName(t));
+                               type, name);
                }
 
                public override void Emit (EmitContext ec)
@@ -614,7 +625,7 @@ namespace Mono.CSharp {
                                if (resolved == null) {
                                        Report.SymbolRelatedToPreviousError (fne.Type);
                                        Report.Error (138, Location,
-                                               "`{0}' is a type not a namespace. A using namespace directive can only be applied to namespaces", Name.ToString ());
+                                               "`{0}' is a type not a namespace. A using namespace directive can only be applied to namespaces", Name.GetSignatureForError ());
                                }
                                return resolved;
                        }
@@ -842,8 +853,7 @@ namespace Mono.CSharp {
                                return;
                        }
 
-                       if (RootContext.Version == LanguageVersion.Default &&
-                           name == "global")
+                       if (RootContext.Version != LanguageVersion.ISO_1 && name == "global")
                                Report.Warning (440, 2, loc, "An alias named `global' will not be used when resolving 'global::';" +
                                        " the global namespace will be used instead");