From: Nathan Froyd Date: Sun, 29 Apr 2007 18:34:20 +0000 (+0000) Subject: 1.0.5.8: always display package prefixes when symbols conflict X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ff218a24fbd70b2ea0aa1e4ca9ac46bb56779226;p=sbcl.git 1.0.5.8: always display package prefixes when symbols conflict * Patch by Kevin Reid, sbcl-devel 2007-04-28. --- diff --git a/NEWS b/NEWS index f565ca5..ab3c173 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ ;;;; -*- coding: utf-8; -*- changes in sbcl-1.0.6 relative to sbcl-1.0.5: + * enhancement: when a symbol name conflict error arises, the + conflicting symbols are always printed with a package prefix. + (thanks to Kevin Reid) * bug fix: GETHASH, (SETF GETHASH), CLRHASH and REMHASH are now interrupt safe. * bug fix: GC race condition occasionally resulting in crashes with diff --git a/src/code/target-package.lisp b/src/code/target-package.lisp index a8598ad..7a914d3 100644 --- a/src/code/target-package.lisp +++ b/src/code/target-package.lisp @@ -786,6 +786,17 @@ error if any of PACKAGES is not a valid package designator." string length hash ehash) (values symbol found)))) +(defun print-symbol-with-prefix (stream symbol colon at) + #!+sb-doc + "For use with ~/: Write SYMBOL to STREAM as if it is not accessible from + the current package." + (declare (ignore colon at)) + ;; Only keywords should be accessible from the keyword package, and + ;; keywords are always printed with colons, so this guarantees that the + ;; symbol will not be printed without a prefix. + (let ((*package* *keyword-package*)) + (write symbol :stream stream :escape t))) + (define-condition name-conflict (reference-condition package-error) ((function :initarg :function :reader name-conflict-function) (datum :initarg :datum :reader name-conflict-datum) @@ -794,7 +805,8 @@ error if any of PACKAGES is not a valid package designator." (:report (lambda (c s) (format s "~@<~S ~S causes name-conflicts in ~S between the ~ - following symbols:~2I~@:_~{~S~^, ~}~:@>" + following symbols:~2I~@:_~ + ~{~/sb-impl::print-symbol-with-prefix/~^, ~}~:@>" (name-conflict-function c) (name-conflict-datum c) (package-error-package c) @@ -812,7 +824,9 @@ error if any of PACKAGES is not a valid package designator." (nlen (length (write-to-string len :base 10))) (*print-pretty* t)) (format *query-io* "~&~@