]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix circular read syntax for records.
authorLars Brinkhoff <lars@nocrew.org>
Sat, 8 Apr 2017 05:07:32 +0000 (07:07 +0200)
committerLars Brinkhoff <lars@nocrew.org>
Sat, 8 Apr 2017 06:47:46 +0000 (08:47 +0200)
* lread.c (substitute_object_recurse): Work with records.

* lread-tests.el (lread-record-1): New test.

src/lread.c
test/src/lread-tests.el

index 6de9fe6e08ec893ebe3a3581fc37e4ae4a4f0355..513f63e43152050a0d81d1c3fd41bc88de4fa280 100644 (file)
@@ -3400,7 +3400,8 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
        if (BOOL_VECTOR_P (subtree))
          return subtree;               /* No sub-objects anyway.  */
        else if (CHAR_TABLE_P (subtree) || SUB_CHAR_TABLE_P (subtree)
-                || COMPILEDP (subtree) || HASH_TABLE_P (subtree))
+                || COMPILEDP (subtree) || HASH_TABLE_P (subtree)
+                || RECORDP (subtree))
          length = ASIZE (subtree) & PSEUDOVECTOR_SIZE_MASK;
        else if (VECTORP (subtree))
          length = ASIZE (subtree);
index a783afd312830476e572b9ddc12f596bcd770c0f..27f967f045b1bcf9362923a3249909577b040e74 100644 (file)
   (should-error (read "#24r") :type 'invalid-read-syntax)
   (should-error (read "#") :type 'invalid-read-syntax))
 
+(ert-deftest lread-record-1 ()
+  (should (equal '(#s(foo) #s(foo))
+                 (read "(#1=#s(foo) #1#)"))))
+
 ;;; lread-tests.el ends here