1.1 --- a/templates/ops.c Mon Nov 28 23:51:45 2016 +0100
1.2 +++ b/templates/ops.c Tue Nov 29 00:47:19 2016 +0100
1.3 @@ -59,6 +59,11 @@
1.4 return obj->pos == __INSTANCEPOS;
1.5 }
1.6
1.7 +int __is_type_instance(__ref obj)
1.8 +{
1.9 + return __HASATTR(__get_class(obj), __TYPE_CLASS_POS, __TYPE_CLASS_CODE);
1.10 +}
1.11 +
1.12 __ref __get_class(__ref obj)
1.13 {
1.14 return __load_via_object(obj, __pos___class__).value;
1.15 @@ -186,6 +191,11 @@
1.16 else
1.17 __raise_type_error();
1.18
1.19 + /* Test for access to a type class attribute using a type instance. */
1.20 +
1.21 + if (__test_specific_type(attr.context, &__TYPE_CLASS_TYPE) && __is_type_instance(context))
1.22 + return __replace_context(context, attr);
1.23 +
1.24 /* Otherwise, preserve the attribute as retrieved. */
1.25
1.26 return attr;