[前][次][番号順一覧][スレッド一覧]

ruby-changes:38974

From: nobu <ko1@a...>
Date: Mon, 29 Jun 2015 02:11:26 +0900 (JST)
Subject: [ruby-changes:38974] nobu:r51054 (trunk): insns.def: preserve encoding

nobu	2015-06-29 02:10:00 +0900 (Mon, 29 Jun 2015)

  New Revision: 51054

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51054

  Log:
    insns.def: preserve encoding
    
    * insns.def (defineclass): preserve encoding of name in error
      messages for non-class super.

  Modified files:
    trunk/ChangeLog
    trunk/insns.def
    trunk/test/ruby/test_class.rb
Index: insns.def
===================================================================
--- insns.def	(revision 51053)
+++ insns.def	(revision 51054)
@@ -844,8 +844,8 @@ defineclass https://github.com/ruby/ruby/blob/trunk/insns.def#L844
 
 	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) {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51053)
+++ ChangeLog	(revision 51054)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Mon Jun 29 02:06:51 2015  Nobuyoshi Nakada  <nobu@r...>
+Mon Jun 29 02:08:01 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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.
Index: test/ruby/test_class.rb
===================================================================
--- test/ruby/test_class.rb	(revision 51053)
+++ test/ruby/test_class.rb	(revision 51054)
@@ -359,6 +359,16 @@ class TestClass < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_class.rb#L359
         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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]