[688891] Copy type parameters for base proxy method
authorMarek Safar <marek.safar@gmail.com>
Thu, 21 Apr 2011 08:55:49 +0000 (09:55 +0100)
committerMarek Safar <marek.safar@gmail.com>
Thu, 21 Apr 2011 09:04:01 +0000 (10:04 +0100)
mcs/mcs/class.cs
mcs/mcs/ecore.cs
mcs/mcs/generic.cs

index 2f8df474114382d9d52c87b121a3799826191d37..cde89cf2a07a19cadd2c599687c62cd2d5a94fe9 100644 (file)
@@ -1130,16 +1130,19 @@ namespace Mono.CSharp
 
                                GenericMethod generic_method;
                                MemberName member_name;
+                               TypeArguments targs = null;
                                if (method.IsGeneric) {
                                        //
                                        // Copy all base generic method type parameters info
                                        //
                                        var hoisted_tparams = method.GenericDefinition.TypeParameters;
-                                       var targs = new TypeArguments ();
                                        var type_params = new TypeParameter[hoisted_tparams.Length];
+                                       targs = new TypeArguments ();
+                                       targs.Arguments = new TypeSpec[type_params.Length];
                                        for (int i = 0; i < type_params.Length; ++i) {
                                                var tp = hoisted_tparams[i];
                                                targs.Add (new TypeParameterName (tp.Name, null, Location));
+                                               targs.Arguments[i] = tp;
                                                type_params[i] = new TypeParameter (tp, this, null, new MemberName (tp.Name), null);
                                        }
 
@@ -1160,6 +1163,8 @@ namespace Mono.CSharp
 
                                var mg = MethodGroupExpr.CreatePredefined (method, method.DeclaringType, Location);
                                mg.InstanceExpression = new BaseThis (method.DeclaringType, Location);
+                               if (targs != null)
+                                       mg.SetTypeArguments (rc, targs);
 
                                // Get all the method parameters and pass them as arguments
                                var real_base_call = new Invocation (mg, block.GetAllParametersArguments ());
index 8bdf49a0f0451f43643a7def76f7f9b9284cf65a..8563f28a212ce5cc0e2a06eeeec0c276788738df 100644 (file)
@@ -2527,7 +2527,7 @@ namespace Mono.CSharp {
                        // Overload resulution works on virtual or non-virtual members only (no overrides). That
                        // means for base.member access we have to find the closest match after we found best candidate
                        //
-                       if ((method.Modifiers & (Modifiers.ABSTRACT | Modifiers.VIRTUAL | Modifiers.STATIC)) != Modifiers.STATIC) {
+                       if ((method.Modifiers & (Modifiers.ABSTRACT | Modifiers.VIRTUAL | Modifiers.OVERRIDE)) != 0) {
                                //
                                // The method could already be what we are looking for
                                //
index a91c4868b04f34179ae87b82acf99c49b8ba91cd..9985549768287156173e8657ab3353ae497c86bb 100644 (file)
@@ -1841,6 +1841,9 @@ namespace Mono.CSharp {
                        get {
                                return atypes;
                        }
+                       set {
+                               atypes = value;
+                       }
                }
 
                public int Count {