Changeset 14449


Ignore:
Timestamp:
03/27/13 14:07:05 (10 years ago)
Author:
Mark Evenson
Message:

Fix UNEXPORT to work on symbols from foreign packages.

No longer check that the symbols which are the target of UNEXPORT are
accessible. Such symbols may be present in a foreign package as they
may have been part of a USE clause for which the original symbol has
subsequently made internal in its home package by a previous UNEXPORT
operation.

Fixes #311.

Location:
trunk/abcl
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Package.java

    r14431 r14449  
    561561
    562562    {
    563         if (symbol.getPackage() == this) {
    564             if (externalSymbols.get(symbol.name.toString()) == symbol) {
    565                 externalSymbols.remove(symbol.name.toString());
    566                 internalSymbols.put(symbol.name.toString(), symbol);
    567             }
    568         } else {
    569             // Signal an error if symbol is not accessible.
    570             if (useList instanceof Cons) {
    571                 LispObject usedPackages = useList;
    572                 while (usedPackages != NIL) {
    573                     Package pkg = (Package) usedPackages.car();
    574                     if (pkg.findExternalSymbol(symbol.name) == symbol)
    575                         return; // OK.
    576                     usedPackages = usedPackages.cdr();
    577                 }
    578             }
    579             StringBuilder sb = new StringBuilder("The symbol ");
    580             sb.append(symbol.getQualifiedName());
    581             sb.append(" is not accessible in package ");
    582             sb.append(name);
    583             error(new PackageError(sb.toString()));
    584         }
     563      if (externalSymbols.get(symbol.name.toString()) == symbol) {
     564        externalSymbols.remove(symbol.name.toString());
     565        internalSymbols.put(symbol.name.toString(), symbol);
     566      } else if (!(internalSymbols.get(symbol.name.toString()) == symbol)) {
     567        StringBuilder sb = new StringBuilder("The symbol ");
     568        sb.append(symbol.getQualifiedName());
     569        sb.append(" is not accessible in package ");
     570        sb.append(name);
     571        error(new PackageError(sb.toString()));
     572      }
    585573    }
    586574
  • trunk/abcl/test/lisp/abcl/bugs.lisp

    r14357 r14449  
    142142  (A . #\Null))
    143143     
     144;;; http://trac.common-lisp.net/armedbear/ticket/311
     145(deftest bugs.export.1
     146   (let ((a (symbol-name (gensym "PACKAGE-")))
     147         (b (symbol-name (gensym "PACKAGE-")))
     148         result)
     149     (make-package a)
     150     (intern "FOO" a)
     151     (export (find-symbol "FOO" a) a)
     152     (make-package b :use (list a))
     153     (export (find-symbol "FOO" b) b)
     154     (unexport (find-symbol "FOO" a) a)
     155     (setf result (unexport (find-symbol "FOO" b) b))
     156     (delete-package a)
     157     (delete-package b)
     158     result)
     159  t)
     160
     161       
Note: See TracChangeset for help on using the changeset viewer.