* class.c (mono_generic_class_get_class): Don't inflated
nested_in since it's not the expected behavior from managed
land. It's a safety issue as well since the outer type can
have more generic arguments.
* TypeTest.cs: Add regression test.
Fixes #643890
{
return a;
}
+
+ public class Nested<K> {}
}
class Foo<T, U>
} catch (TypeLoadException) { }
}
+
+ [Test] //Bug643890
+ public void DeclaringTypeOfGenericNestedTypeInstanceIsOpen ()
+ {
+ var type = typeof (Foo<int>.Nested<string>);
+ Assert.AreSame (typeof (Foo<>), a.DeclaringType, "#1");
+ }
#if NET_4_0
interface IGetInterfaceMap<in T>
gklass = gclass->container_class;
if (gklass->nested_in) {
- /*
- * FIXME: the nested type context should include everything the
- * nesting context should have, but it may also have additional
- * generic parameters...
- */
- klass->nested_in = mono_class_inflate_generic_class (gklass->nested_in,
- mono_generic_class_get_context (gclass));
+ /* The nested_in type should not be inflated since it's possible to produce a nested type with less generic arguments*/
+ klass->nested_in = gklass->nested_in;
}
klass->name = gklass->name;