From b90a5f9334a84b46a49b0966ecd250c2e52a8312 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 28 Jun 2015 17:10:00 +0000 Subject: [PATCH] insns.def: preserve encoding * insns.def (defineclass): preserve encoding of name in error messages for non-class super. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++++- insns.def | 4 ++-- test/ruby/test_class.rb | 10 ++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3bd909307..b4ed3c3a20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Mon Jun 29 02:06:51 2015 Nobuyoshi Nakada +Mon Jun 29 02:08:01 2015 Nobuyoshi Nakada + + * insns.def (defineclass): preserve encoding of name in error + messages for non-class super. * insns.def (defineclass): preserve encoding of name in error messages when already defined but type mismatch. diff --git a/insns.def b/insns.def index dd6e8e24b5..b983140fd8 100644 --- a/insns.def +++ b/insns.def @@ -844,8 +844,8 @@ defineclass if (VM_DEFINECLASS_HAS_SUPERCLASS_P(flags) && !RB_TYPE_P(super, T_CLASS)) { - rb_raise(rb_eTypeError, "superclass must be a Class (%s given)", - rb_obj_classname(super)); + rb_raise(rb_eTypeError, "superclass must be a Class (% "PRIsVALUE" given)", + rb_obj_class(super)); } if (super == Qnil) { diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 4f7e037580..27558e33dd 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -359,6 +359,16 @@ class TestClass < Test::Unit::TestCase end end; end + + m = Module.new + n = "M\u{1f5ff}" + c = m.module_eval "class #{n}; new; end" + assert_raise_with_message(TypeError, /#{n}/) { + eval <<-"end;" + class C < c + end + end; + } end def test_cloned_singleton_method_added