edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Binding/MetaPythonType.Members.cs;C864959
File: MetaPythonType.Members.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Binding/MetaPythonType.Members.cs;C864959  (server)    6/6/2009 11:20 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Binding/MetaPythonType.Members.cs;ProGenFix
@@ -25,6 +25,7 @@
 
 using Microsoft.Scripting;
 using Microsoft.Scripting.Actions;
+using Microsoft.Scripting.Generation;
 using Microsoft.Scripting.Runtime;
 
 using IronPython.Runtime.Operations;
@@ -812,14 +813,14 @@
             PropertyTracker pt = mt as PropertyTracker;
             if (pt != null) {
                 MethodInfo mi = pt.GetSetMethod(true);
-                if (mi != null && (mi.IsFamily || mi.IsFamilyOrAssembly)) {
+                if (mi != null && mi.IsProtected()) {
                     return true;
                 }
             }
 
             FieldTracker ft = mt as FieldTracker;
             if (ft != null) {
-                return ft.Field.IsFamily || ft.Field.IsFamilyOrAssembly;
+                return ft.Field.IsProtected();
             }
 
             return false;
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Operations/PythonTypeOps.cs;C907945
File: PythonTypeOps.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Operations/PythonTypeOps.cs;C907945  (server)    6/6/2009 11:22 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Operations/PythonTypeOps.cs;ProGenFix
@@ -752,7 +752,7 @@
                     return info;
                 }
 
-                if (info.IsFamily || info.IsFamilyOrAssembly) {
+                if (info.IsProtected()) {
                     return info;
                 }
             }
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/BuiltinFunction.cs;C918720
File: BuiltinFunction.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/BuiltinFunction.cs;C918720  (server)    6/6/2009 11:22 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/BuiltinFunction.cs;ProGenFix
@@ -419,7 +419,7 @@
             BindingTarget target = result.Target;
             res = result.MetaObject;
             
-            if (target.Method != null && (target.Method.IsFamily || target.Method.IsFamilyOrAssembly)) {
+            if (target.Method != null && target.Method.IsProtected()) {
                 // report an error when calling a protected member
                 res = new DynamicMetaObject(
                     BindingHelpers.TypeErrorForProtectedMember(
@@ -618,7 +618,7 @@
             BindingTarget target = result.Target;
             res = result.Function;
 
-            if (target.Method != null && (target.Method.IsFamily || target.Method.IsFamilyOrAssembly)) {
+            if (target.Method != null && target.Method.IsProtected()) {
                 MethodBase method = target.Method;
                 // report an error when calling a protected member
                 res = delegate(object[] callArgs, out bool shouldOptimize) { 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/NewTypeMaker.cs;C921161
File: NewTypeMaker.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/NewTypeMaker.cs;C921161  (server)    6/6/2009 11:23 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/NewTypeMaker.cs;ProGenFix
@@ -337,7 +337,7 @@
                                                     );
 
             foreach (ConstructorInfo ci in constructors) {
-                if (ci.IsPublic || ci.IsFamily || ci.IsFamilyOrAssembly) {
+                if (ci.IsPublic || ci.IsProtected()) {
                     OverrideConstructor(ci);
                 }
             }
@@ -774,7 +774,7 @@
 
             FieldInfo[] fields = _baseType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
             foreach (FieldInfo fi in fields) {
-                if (!fi.IsFamily && !fi.IsFamilyOrAssembly) {
+                if (!fi.IsProtected()) {
                     continue;
                 }
 
@@ -876,7 +876,7 @@
             foreach (MethodInfo mi in added.Values) {
                 if (!CanOverrideMethod(mi)) continue;
 
-                if (mi.IsPublic || IsProtected(mi)) {
+                if (mi.IsPublic || mi.IsProtected()) {
                     if (mi.IsSpecialName) {
                         OverrideSpecialName(mi, specialNames, overriddenProperties);
                     } else {
@@ -891,7 +891,7 @@
                 // TODO: A better check here would be mi.IsFamily && mi.IsSpecialName.  But we need to also check
                 // the other property method (getter if we're a setter, setter if we're a getter) because if one is protected
                 // and the other isn't we need to still override both (so our newslot property is also both a getter and a setter).
-                if ((IsProtected(mi) || mi.IsSpecialName) && (mi.Name.StartsWith("get_") || mi.Name.StartsWith("set_"))) {
+                if ((mi.IsProtected() || mi.IsSpecialName) && (mi.Name.StartsWith("get_") || mi.Name.StartsWith("set_"))) {
                     // need to be able to call into protected getter/setter methods from derived types,
                     // even if these methods aren't virtual and we are in partial trust.
                     specialNames[mi.Name] = new[] { mi.Name };
@@ -983,7 +983,7 @@
         private void AddPublicProperty(MethodInfo mi, Dictionary<PropertyInfo, PropertyBuilder> overridden, MethodBuilder mb, PropertyInfo foundProperty) {
             MethodInfo getter = foundProperty.GetGetMethod(true);
             MethodInfo setter = foundProperty.GetSetMethod(true);
-            if (IsProtected(getter) || IsProtected(setter)) {
+            if (getter != null && getter.IsProtected() || setter != null && setter.IsProtected()) {
                 PropertyBuilder builder;
                 if (!overridden.TryGetValue(foundProperty, out builder)) {
                     ParameterInfo[] indexArgs = foundProperty.GetIndexParameters();
@@ -1003,13 +1003,6 @@
             }
         }
 
-        private static bool IsProtected(MethodInfo mi) {
-            if (mi != null) {
-                return mi.IsFamilyOrAssembly || mi.IsFamily;
-            }
-            return false;
-        }
-
         /// <summary>
         /// Loads all the incoming arguments and forwards them to mi which
         /// has the same signature and then returns the result
@@ -1036,7 +1029,7 @@
         }
 
         private void OverrideBaseMethod(MethodInfo mi, Dictionary<string, string[]> specialNames) {
-            if ((!mi.IsVirtual || mi.IsFinal) && !IsProtected(mi)) {
+            if ((!mi.IsVirtual || mi.IsFinal) && !mi.IsProtected()) {
                 return;
             }
 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/ReflectedProperty.cs;C840659
File: ReflectedProperty.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/ReflectedProperty.cs;C840659  (server)    6/6/2009 11:27 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/ReflectedProperty.cs;ProGenFix
@@ -58,7 +58,7 @@
                 foreach (MethodInfo mi in Setter) {
                     if(mi.IsStatic && DeclaringType != owner.UnderlyingSystemType) {
                         return false;
-                    } else if (mi.IsFamily || mi.IsFamilyAndAssembly) {
+                    } else if (mi.IsProtected()) {
                         throw PythonOps.TypeErrorForProtectedMember(owner.UnderlyingSystemType, _info.Name);
                     }
                 }
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/TypeInfo.cs;C870448
File: TypeInfo.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/TypeInfo.cs;C870448  (server)    6/6/2009 11:27 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/IronPython/IronPython/Runtime/Types/TypeInfo.cs;ProGenFix
@@ -1535,15 +1535,15 @@
 
             switch (input.MemberType) {
                 case MemberTypes.Method:
-                    return ((MethodInfo)input).IsFamily || ((MethodInfo)input).IsFamilyOrAssembly;
+                    return ((MethodInfo)input).IsProtected();
                 case MemberTypes.Property:
                     MethodInfo mi = ((PropertyInfo)input).GetGetMethod(true);
                     if (mi != null) return ProtectedOnly(mi);
                     return false;
                 case MemberTypes.Field:
-                    return ((FieldInfo)input).IsFamily || ((FieldInfo)input).IsFamilyOrAssembly;
+                    return ((FieldInfo)input).IsProtected();
                 case MemberTypes.NestedType:
-                    return ((Type)input).IsNestedFamily || ((Type)input).IsNestedFamORAssem;
+                    return ((Type)input).IsProtected();
                 default:
                     return false;
             }
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs;C926894
File: ClrTests.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs;C926894  (server)    6/6/2009 11:14 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ClrTests.cs;ProGenFix
@@ -219,14 +219,16 @@
         public class ProtectedA {
             protected string Foo(int a) { return "Foo(I): " + a; }
             public string Bar(int a) { return "Bar(I): " + a; }
+
+            protected string PG<T>(T a) { return "PG<T>(T)"; }
         }
 
         public class ProtectedB : ProtectedA {
             public string Foo(object a) { return "Foo(O): " + a.ToString(); }
-            protected string Bar(object a) { return "Bar(O): " + a; }
+            internal protected string Bar(object a) { return "Bar(O): " + a; }
 
             protected int Prop1 { get; set; }
-            public int Prop2 { get; protected set; }
+            public int Prop2 { get; internal protected set; }
 
             private string Baz(int a) { return "Baz(I): " + a; }
             public string Baz(object a) { return "Baz(O): " + a; }
@@ -234,6 +236,8 @@
             protected static string StaticM() { return "StaticM"; }
             protected static string StaticGenericM<T>(T f) { return "StaticGenericM: " + f.ToString(); }
 
+            internal protected string PG<T>(T a, int b) { return "PG<T>(T,int)"; }
+
             // TODO:
             // protected int Fld;
             // protected static int Fld;
@@ -279,6 +283,18 @@
 StaticGenericM: 123
 ", OutputFlags.Match);
 
+            // generic methods:
+            TestOutput(@"
+class C < B; end
+c = C.new
+
+puts c.method(:PG).of(Fixnum).call(1)
+puts c.method(:PG).of(Fixnum).call(1,2)
+", @"
+PG<T>(T)
+PG<T>(T,int)
+");
+
             // properties:
             AssertOutput(delegate() {
                 CompilerTest(@"
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;C928062
File: RubyClass.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;C928062  (server)    6/6/2009 10:44 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;ProGenFix
@@ -986,7 +986,7 @@
                 return false;
             }
 
-            if (method.IsFamily || method.IsFamilyOrAssembly) {
+            if (method.IsProtected()) {
                 return method.DeclaringType != null && method.DeclaringType.IsVisible && !method.DeclaringType.IsSealed;
             }
 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/ClsTypeEmitter.cs;C922537
File: ClsTypeEmitter.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/ClsTypeEmitter.cs;C922537  (server)    6/6/2009 10:38 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/ClsTypeEmitter.cs;ProGenFix
@@ -173,7 +173,7 @@
 
             FieldInfo[] fields = _baseType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy);
             foreach (FieldInfo fi in fields) {
-                if (!fi.IsFamily && !fi.IsFamilyOrAssembly) {
+                if (!CompilerHelpers.IsProtected(fi)) {
                     continue;
                 }
 
@@ -275,7 +275,7 @@
             foreach (MethodInfo mi in added.Values) {
                 if (!ShouldOverrideVirtual(mi) || !CanOverrideMethod(mi)) continue;
 
-                if (mi.IsPublic || mi.IsFamily || mi.IsFamilyOrAssembly) {
+                if (mi.IsPublic || mi.IsProtected()) {
                     if (mi.IsSpecialName) {
                         OverrideSpecialName(mi, overriddenProperties);
                     } else {
@@ -287,7 +287,7 @@
 
         private void OverrideSpecialName(MethodInfo mi, Dictionary<PropertyInfo, PropertyBuilder> overridden) {
             if (!mi.IsVirtual || mi.IsFinal) {
-                if ((mi.IsFamily || mi.IsSpecialName) && (mi.Name.StartsWith("get_") || mi.Name.StartsWith("set_"))) {
+                if ((mi.IsProtected() || mi.IsSpecialName) && (mi.Name.StartsWith("get_") || mi.Name.StartsWith("set_"))) {
                     // need to be able to call into protected getter/setter methods from derived types,
                     // even if these methods aren't virtual and we are in partial trust.
                     _specialNames.SetSpecialName(mi.Name);
@@ -379,7 +379,7 @@
         private void AddPublicProperty(MethodInfo mi, Dictionary<PropertyInfo, PropertyBuilder> overridden, MethodBuilder mb, PropertyInfo foundProperty) {
             MethodInfo getter = foundProperty.GetGetMethod(true);
             MethodInfo setter = foundProperty.GetSetMethod(true);
-            if (IsProtected(getter) || IsProtected(setter)) {
+            if (getter != null && getter.IsProtected() || setter != null && setter.IsProtected()) {
                 PropertyBuilder builder;
                 if (!overridden.TryGetValue(foundProperty, out builder)) {
                     ParameterInfo[] indexArgs = foundProperty.GetIndexParameters();
@@ -399,13 +399,6 @@
             }
         }
 
-        private static bool IsProtected(MethodInfo mi) {
-            if (mi != null) {
-                return mi.IsFamilyOrAssembly || mi.IsFamily;
-            }
-            return false;
-        }
-
         /// <summary>
         /// Loads all the incoming arguments and forwards them to mi which
         /// has the same signature and then returns the result
@@ -432,7 +425,7 @@
         }
 
         private void OverrideBaseMethod(MethodInfo mi) {
-            if ((!mi.IsVirtual || mi.IsFinal) && !mi.IsFamily) {
+            if ((!mi.IsVirtual || mi.IsFinal) && !mi.IsProtected()) {
                 return;
             }
 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/RubyTypeBuilder.cs;C926894
File: RubyTypeBuilder.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/RubyTypeBuilder.cs;C926894  (server)    6/6/2009 10:36 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Compiler/Generation/RubyTypeBuilder.cs;ProGenFix
@@ -98,7 +98,7 @@
         private static readonly Type/*!*/[]/*!*/ _exceptionMessageSignature = new Type[] { typeof(string) };
 
         private static bool IsAvailable(MethodBase/*!*/ method) {
-            return method != null && !method.IsPrivate && !method.IsFamilyAndAssembly;
+            return method != null && !method.IsPrivate && !method.IsAssembly && !method.IsFamilyAndAssembly;
         }
 
         private enum SignatureAdjustment {
@@ -125,7 +125,7 @@
             var ctors = new List<ConstructorBuilderInfo>();
 
             foreach (var baseCtor in _tb.BaseType.GetConstructors(bindingFlags)) {
-                if (!baseCtor.IsPublic && !baseCtor.IsFamily) {
+                if (!baseCtor.IsPublic && !baseCtor.IsProtected()) {
                     continue;
                 }
 
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;C933447
File: RubyUtils.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;C933447  (server)    6/6/2009 11:29 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/RubyUtils.cs;ProGenFix
@@ -651,7 +651,7 @@
         }
 
         private static bool IsAvailable(MethodBase method) {
-            return method != null && !method.IsPrivate && !method.IsFamilyAndAssembly;
+            return method != null && !method.IsPrivate && !method.IsAssembly && !method.IsFamilyAndAssembly;
         }
 
         public static object/*!*/ CreateObject(RubyClass/*!*/ theClass) {
===================================================================
edit: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupInfo.cs;C927503
File: RubyMethodGroupInfo.cs
===================================================================
--- $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupInfo.cs;C927503  (server)    6/6/2009 10:43 AM
+++ Shelved Change: $/Dev10/feature/vs_langs01/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMethodGroupInfo.cs;ProGenFix
@@ -24,6 +24,7 @@
 using Microsoft.Scripting.Utils;
 using Ast = System.Linq.Expressions.Expression;
 using Microsoft.Scripting;
+using Microsoft.Scripting.Generation;
 
 namespace IronRuby.Runtime.Calls {
     /// <summary>
@@ -194,7 +195,7 @@
 
                 for (int i = 0; i < overloads.Count; i++) {
                     var overload = overloads[i];
-                    if (overload.IsFamily || overload.IsFamilyOrAssembly) {
+                    if (overload.IsProtected()) {
                         if (newOverloads == null) {
                             newOverloads = CollectionUtils.GetRange(overloads, 0, i);
 
@@ -227,10 +228,6 @@
 
                             Debug.Assert(visibleMethod != null);
 
-                            if (overload.IsGenericMethod) {
-                                visibleMethod = visibleMethod.MakeGenericMethod(genericArguments);
-                            }
-
                             newOverloads.Add(visibleMethod);
                         }
                     } else if (newOverloads != null) {
@@ -246,10 +243,20 @@
             Type/*!*/ type, string/*!*/ name, BindingFlags bindingFlags) {
 
             var overloads = type.GetMember(name, MemberTypes.Method, bindingFlags);
-            foreach (MethodInfo overload in overloads) {
-                if ((genericParameterTypes != null) == overload.IsGenericMethod &&
-                    ReflectionUtils.GetParameterTypes(overload.GetParameters()).ValueEquals(parameterTypes) &&
-                    !overload.IsGenericMethod || overload.GetGenericArguments().Length == genericParameterTypes.Length) {
+            for (int i = 0; i < overloads.Length; i++) {
+                MethodInfo overload = (MethodInfo)overloads[i];
+                if ((genericParameterTypes != null) != overload.IsGenericMethod) {
+                    continue;
+                }
+
+                if (overload.IsGenericMethod) {
+                    if (overload.GetGenericArguments().Length != genericParameterTypes.Length) {
+                        continue;
+                    }
+                    overload = overload.MakeGenericMethod(genericParameterTypes);
+                }
+
+                if (ReflectionUtils.GetParameterTypes(overload.GetParameters()).ValueEquals(parameterTypes)) {
                     return overload;
                 }
             }
===================================================================
