diff options
| author | Philipp Stephani | 2018-01-07 14:14:38 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2018-01-07 14:14:38 +0100 |
| commit | 610dad1102cba5fa6111050d30c734b51bcdb77d (patch) | |
| tree | e017da7f090e2125d21dbc4d5600a444765f5277 | |
| parent | 6735df4443fe0aa60862a95c38746edf2b053862 (diff) | |
| download | emacs-610dad1102cba5fa6111050d30c734b51bcdb77d.tar.gz emacs-610dad1102cba5fa6111050d30c734b51bcdb77d.zip | |
Revert "Prevent name clashes between CL structures and builtin types"
This reverts commit 151496a4b96430924bc148f85b9c8471d1e132b1.
That commit breaks bootstrap builds due to a cyclic dependency.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-preloaded.el | 8 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cl-macs-tests.el | 9 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cl-preloaded-tests.el | 33 |
5 files changed, 0 insertions, 58 deletions
| @@ -190,10 +190,6 @@ calling 'eldoc-message' directly. | |||
| 190 | ** Old-style backquotes now generate an error. They have been | 190 | ** Old-style backquotes now generate an error. They have been |
| 191 | generating warnings for a decade. | 191 | generating warnings for a decade. |
| 192 | 192 | ||
| 193 | ** Defining a Common Lisp structure using 'cl-defstruct' or | ||
| 194 | 'cl-struct-define' whose name clashes with a builtin type (e.g., | ||
| 195 | 'integer' or 'hash-table') now signals an error. | ||
| 196 | |||
| 197 | 193 | ||
| 198 | * Lisp Changes in Emacs 27.1 | 194 | * Lisp Changes in Emacs 27.1 |
| 199 | 195 | ||
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 05cb9b091d9..16f33282bae 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -43,7 +43,6 @@ | |||
| 43 | 43 | ||
| 44 | ;;; Code: | 44 | ;;; Code: |
| 45 | 45 | ||
| 46 | (require 'cl-generic) | ||
| 47 | (require 'cl-lib) | 46 | (require 'cl-lib) |
| 48 | (require 'macroexp) | 47 | (require 'macroexp) |
| 49 | ;; `gv' is required here because cl-macs can be loaded before loaddefs.el. | 48 | ;; `gv' is required here because cl-macs can be loaded before loaddefs.el. |
| @@ -2664,9 +2663,6 @@ non-nil value, that slot cannot be set via `setf'. | |||
| 2664 | (forms nil) | 2663 | (forms nil) |
| 2665 | (docstring (if (stringp (car descs)) (pop descs))) | 2664 | (docstring (if (stringp (car descs)) (pop descs))) |
| 2666 | pred-form pred-check) | 2665 | pred-form pred-check) |
| 2667 | ;; Can't use `cl-check-type' yet. | ||
| 2668 | (unless (cl--struct-name-p name) | ||
| 2669 | (signal 'wrong-type-argument (list 'cl-struct-name-p name 'name))) | ||
| 2670 | (setq descs (cons '(cl-tag-slot) | 2666 | (setq descs (cons '(cl-tag-slot) |
| 2671 | (mapcar (function (lambda (x) (if (consp x) x (list x)))) | 2667 | (mapcar (function (lambda (x) (if (consp x) x (list x)))) |
| 2672 | descs))) | 2668 | descs))) |
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 33a1438f690..4e73a4a31b7 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | 36 | ||
| 37 | ;;; Code: | 37 | ;;; Code: |
| 38 | 38 | ||
| 39 | (eval-when-compile (require 'cl-generic)) | ||
| 40 | (eval-when-compile (require 'cl-lib)) | 39 | (eval-when-compile (require 'cl-lib)) |
| 41 | (eval-when-compile (require 'cl-macs)) ;For cl--struct-class. | 40 | (eval-when-compile (require 'cl-macs)) ;For cl--struct-class. |
| 42 | 41 | ||
| @@ -51,12 +50,6 @@ | |||
| 51 | (apply #'error string (append sargs args)) | 50 | (apply #'error string (append sargs args)) |
| 52 | (signal 'cl-assertion-failed `(,form ,@sargs))))) | 51 | (signal 'cl-assertion-failed `(,form ,@sargs))))) |
| 53 | 52 | ||
| 54 | (defun cl--struct-name-p (name) | ||
| 55 | "Return t if NAME is a valid structure name for `cl-defstruct'." | ||
| 56 | (and name (symbolp name) (not (keywordp name)) | ||
| 57 | (not (memq name (eval-when-compile cl--generic-all-builtin-types))) | ||
| 58 | t)) | ||
| 59 | |||
| 60 | ;; When we load this (compiled) file during pre-loading, the cl--struct-class | 53 | ;; When we load this (compiled) file during pre-loading, the cl--struct-class |
| 61 | ;; code below will need to access the `cl-struct' info, since it's considered | 54 | ;; code below will need to access the `cl-struct' info, since it's considered |
| 62 | ;; already as its parent (because `cl-struct' was defined while the file was | 55 | ;; already as its parent (because `cl-struct' was defined while the file was |
| @@ -117,7 +110,6 @@ | |||
| 117 | ;;;###autoload | 110 | ;;;###autoload |
| 118 | (defun cl-struct-define (name docstring parent type named slots children-sym | 111 | (defun cl-struct-define (name docstring parent type named slots children-sym |
| 119 | tag print) | 112 | tag print) |
| 120 | (cl-check-type name cl--struct-name) | ||
| 121 | (unless type | 113 | (unless type |
| 122 | ;; Legacy defstruct, using tagged vectors. Enable backward compatibility. | 114 | ;; Legacy defstruct, using tagged vectors. Enable backward compatibility. |
| 123 | (cl-old-struct-compat-mode 1)) | 115 | (cl-old-struct-compat-mode 1)) |
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index 9236ac73b50..f0bde7af397 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el | |||
| @@ -497,13 +497,4 @@ collection clause." | |||
| 497 | vconcat (vector (1+ x))) | 497 | vconcat (vector (1+ x))) |
| 498 | [2 3 4 5 6]))) | 498 | [2 3 4 5 6]))) |
| 499 | 499 | ||
| 500 | |||
| 501 | (ert-deftest cl-defstruct/builtin-type () | ||
| 502 | (should-error | ||
| 503 | (macroexpand '(cl-defstruct hash-table)) | ||
| 504 | :type 'wrong-type-argument) | ||
| 505 | (should-error | ||
| 506 | (macroexpand '(cl-defstruct (hash-table (:predicate hash-table-p)))) | ||
| 507 | :type 'wrong-type-argument)) | ||
| 508 | |||
| 509 | ;;; cl-macs-tests.el ends here | 500 | ;;; cl-macs-tests.el ends here |
diff --git a/test/lisp/emacs-lisp/cl-preloaded-tests.el b/test/lisp/emacs-lisp/cl-preloaded-tests.el deleted file mode 100644 index 008a6e629f5..00000000000 --- a/test/lisp/emacs-lisp/cl-preloaded-tests.el +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | ;;; cl-preloaded-tests.el --- unit tests for cl-preloaded.el -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2017 Free Software Foundation, Inc. | ||
| 4 | ;; Author: Philipp Stephani <phst@google.com> | ||
| 5 | |||
| 6 | ;; This file is part of GNU Emacs. | ||
| 7 | |||
| 8 | ;; This program is free software; you can redistribute it and/or modify | ||
| 9 | ;; it under the terms of the GNU General Public License as published by | ||
| 10 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 11 | ;; (at your option) any later version. | ||
| 12 | |||
| 13 | ;; This program is distributed in the hope that it will be useful, | ||
| 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | ;; GNU General Public License for more details. | ||
| 17 | |||
| 18 | ;; You should have received a copy of the GNU General Public License | ||
| 19 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | |||
| 21 | ;;; Commentary: | ||
| 22 | |||
| 23 | ;; Unit tests for lisp/emacs-lisp/cl-preloaded.el. | ||
| 24 | |||
| 25 | ;;; Code: | ||
| 26 | |||
| 27 | (ert-deftest cl-struct-define/builtin-type () | ||
| 28 | (should-error | ||
| 29 | (cl-struct-define 'hash-table nil nil 'record nil nil | ||
| 30 | 'cl-preloaded-tests-tag 'cl-preloaded-tests nil) | ||
| 31 | :type 'wrong-type-argument)) | ||
| 32 | |||
| 33 | ;;; cl-preloaded-tests.el ends here | ||