Fix to not define outer when outer is itself.
example:
a = Class.new
a::A = a
MODIFY
src/class.c
src/class.c
@@ -65,7 +65,7 @@ mrb_class_name_class(mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb
else {
name = mrb_class_path(mrb, outer);
if (mrb_nil_p(name)) { /* unnamed outer class */
- if (outer != mrb->object_class) {
+ if (outer != mrb->object_class && outer != c) {
mrb_obj_iv_set(mrb, (struct RObject*)c, mrb_intern_lit(mrb, "__outer__"),
mrb_obj_value(outer));
}

MODIFY
src/variable.c
src/variable.c
@@ -377,8 +377,9 @@ is_namespace(enum mrb_vtype tt)
static inline void
assign_class_name(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
{
- if (is_namespace(obj->tt) && is_namespace(mrb_type(v)) && ISUPPER(mrb_sym2name(mrb, sym)[0])) {
+ if (is_namespace(obj->tt) && is_namespace(mrb_type(v))) {
struct RObject *c = mrb_obj_ptr(v);
+ if (obj != c && ISUPPER(mrb_sym2name(mrb, sym)[0])) {
mrb_sym id_classname = mrb_intern_lit(mrb, "__classname__");
mrb_value o = mrb_obj_iv_get(mrb, c, id_classname);
@@ -397,6 +398,7 @@ assign_class_name(mrb_state *mrb, struct RObject *obj, mrb_sym sym, mrb_value v)
}
}
}
+}
#endif
MRB_API void

Fix to not define outer when outer is itself.

example:
  a = Class.new
  a::A = a