robert-strandh / SICL

A fresh implementation of Common Lisp
Other
1.07k stars 79 forks source link

ERROR during macroexpansion: : Can't deal with object #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> #170

Closed Harag closed 4 years ago

Harag commented 4 years ago

Host: SBCL (latest version from git) Using: sicl repl Last Call: SICL-HIR-INTERPRETER:INTERPRET-INSTRUCTION

ERROR during macroexpansion: Can't deal with object #

Was playing with SICL repl and pasted a piece of code that phoe posted on #lisp just to see what SICL would do and got error above.

Code to reproduce error:

(define-condition test-condition (error)
  ((test-slot :reader test-slot :initarg :test-slot)))

(defun test-function ()
  (restart-case
      (error 'test-condition :test-slot 1)
    (testable-restart ()
      :report "Visible restart."
      :test (lambda (c) (format t ";; From restart test function: ~A~%" c)
              (and (typep c 'test-condition) (eql (test-slot c) 1)))
      nil)))

lexical-environment

#<HASH-TABLE {102936DB13}>
--------------------
Count: 31
Size: 42
Test: EQ
Rehash size: 1.5
Rehash threshold: 1.0
[clear hashtable]
Contents: 
#<CLEAVIR-IR:LEXICAL-LOCATION G511033> = #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511041> = #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION tagbody511027> = (#<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102936E613}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102936E5A3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029341D13}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102933AAC3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029338F23}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102932FDA3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028E006C3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFFAE3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFE853}>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION TAGBODY-CONTINUATION> = (NIL) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION augmentation-function> = #<CLOSURE (LAMBDA (&REST SICL-SIMPLE-ENVIRONMENT::ARGS) :IN INITIALIZE-INSTANCE) {1001785E2B}> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511007> = #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION g511007> = #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511019> = #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511020> = (#<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION block511017> = (#<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102936E5A3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029341D13}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102933AAC3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029338F23}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102932FDA3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028E006C3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFFAE3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFE853}>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION BLOCK-CONTINUATION> = (NIL) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION augmentation-function> = #<CLOSURE (LAMBDA (&REST SICL-SIMPLE-ENVIRONMENT::ARGS) :IN INITIALIZE-INSTANCE) {1001785E2B}> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION ARGUMENTS> = (#<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION argument511045> = #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION index511046> = -1 [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION cons511044> = #<FUNCTION CONS> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION arguments> = (#<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION argc511042> = 1 [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511055511057> = #<HEADER {103ADF40EB}> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511048511059> = (#<FUNCTION FUNCALL>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511054511061> = (T) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511053511063> = #<HEADER {1001AFAA5B}> [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511047511065> = (#<HEADER {1001AFCBAB}>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511049511067> = (#<CLOSURE (LAMBDA (&REST SICL-SIMPLE-ENVIRONMENT::ARGS) :IN INITIALIZE-INSTANCE) {1001785E2B}>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511050511069> = (#<FUNCTION CONS>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511052511071> = NIL [remove entry]
SICL-HIR-INTERPRETER:ARGUMENTS = #(#<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING>) [remove entry]
SICL-HIR-INTERPRETER::DYNAMIC-ENVIRONMENT = (#<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102936E613}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102936E5A3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029341D13}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102933AAC3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029338F23}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102932FDA3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028E006C3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFFAE3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFE853}>) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION function511015> = (#<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029341D13}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102933AAC3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1029338F23}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {102932FDA3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028E006C3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFFAE3}> #<SICL-RUN-TIME:BLOCK/TAGBODY-ENTRY (NIL) {1028DFE853}>) [remove entry]
SICL-HIR-INTERPRETER::STATIC-ENVIRONMENT = #(#<HEADER {103ADFCAEB}> #<CLOSURE (LABELS ENCLOSE :IN TIE-CODE-OBJECT) {103ADFCB1B}> #<CLOSURE (LABELS INITIALIZE-CLOSURE :IN TIE-CODE-OBJECT) {103ADFCB4B}> #<FUNCTION CONS> NIL #<HEADER {103ADF40EB}> (#<FUNCTION FUNCALL>) (T) #<HEADER {1001AFAA5B}> (#<HEADER {1001AFCBAB}>) (#<CLOSURE (LAMBDA (&REST SICL-SIMPLE-ENVIRONMENT::ARGS) :IN INITIALIZE-INSTANCE) {1001785E2B}>) (#<FUNCTION CONS>) NIL (#<HEADER {10401E792B}>)) [remove entry]
#<CLEAVIR-IR:LEXICAL-LOCATION G511016> = #(#<HEADER {103ADFCAEB}> #<CLOSURE (LABELS ENCLOSE :IN TIE-CODE-OBJECT) {103ADFCB1B}> #<CLOSURE (LABELS INITIALIZE-CLOSURE :IN TIE-CODE-OBJECT) {103ADFCB4B}> #<FUNCTION CONS> NIL #<HEADER {103ADF40EB}> (#<FUNCTION FUNCALL>) (T) #<HEADER {1001AFAA5B}> (#<HEADER {1001AFCBAB}>) (#<CLOSURE (LAMBDA (&REST SICL-SIMPLE-ENVIRONMENT::ARGS) :IN INITIALIZE-INSTANCE) {1001785E2B}>) (#<FUNCTION CONS>) NIL (#<HEADER {10401E792B}>)) [remove entry]

PARTIAL Backtrace:

  0: (SB-KERNEL:WITH-SIMPLE-CONDITION-RESTARTS ERROR NIL CLEAVIR-CST-TO-AST:MACROEXPANSION-ERROR :CST #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR (QUOTE TEST-CONDITION) :TEST-SLOT 1) (TESTABL..
      Locals:
        CERROR-ARG = NIL
        FUNCTION = ERROR
        #:G13 = CLEAVIR-CST-TO-AST:MACROEXPANSION-ERROR
        SB-DEBUG::MORE = (:CST ..)
  1: ((LAMBDA (CONDITION) :IN CLEAVIR-CST-TO-AST::ERROR-ENCAPSULATOR) #<SIMPLE-ERROR "Can't deal with object ~s" {102936EB33}>)
      Locals:
        CONDITION = #<SIMPLE-ERROR "Can't deal with object ~s" {102936EB33}>
  2: (SB-KERNEL::%SIGNAL #<SIMPLE-ERROR "Can't deal with object ~s" {102936EB33}>)
      Locals:
        CONDITION = #<SIMPLE-ERROR "Can't deal with object ~s" {102936EB33}>
        HANDLER-CLUSTERS = (((#<SB-KERNEL::CLASSOID-CELL SB-IMPL::EVAL-ERROR> . #<CLOSURE # {7F85CA3E5E9B}>)) ((#<SB-KERNEL::CLASSOID-CELL SB-C:COMPILER-ERROR> . #<FUNCTION # {52141BAB}>)) ..)
  3: (ERROR "Can't deal with object ~s" #<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING>)
      Locals:
        CONDITION = #<SIMPLE-ERROR "Can't deal with object ~s" {102936EB33}>
        #:G2 = "Can't deal with object ~s"
        SB-DEBUG::MORE = (#<BUILT-IN-CLASS SB-KERNEL:SIMPLE-CHARACTER-STRING>)
  4: ((:METHOD SICL-HIR-INTERPRETER:INTERPRET-INSTRUCTION (CLIENT CLEAVIR-IR:NOOK-READ-INSTRUCTION T)) #<unused argument> #<CLEAVIR-IR:NOOK-READ-INSTRUCTION {103B460A23}> #<HASH-TABLE :TEST EQ :COUNT 31 {1..
      Locals:
        SICL-BOOT-PHASE-3::INSTRUCTION = #<CLEAVIR-IR:NOOK-READ-INSTRUCTION {103B460A23}>
        SICL-BOOT-PHASE-3::LEXICAL-ENVIRONMENT = #<HASH-TABLE :TEST EQ :COUNT 31 {102936DB13}>
....

 70: (CLEAVIR-CST-TO-AST::EXPAND-MACRO #<HEADER {103FD2762B}> #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR (QUOTE TEST-CONDITION) :TEST-SLOT 1) (TESTABLE-RESTART NIL :REPORT "Visible restart."..
      Locals:
        CST = #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR 'TEST-CONDITION :TEST-SLOT 1) ..) {102864FF73}>
        ENVIRONMENT = #<TRUCLER-REFERENCE:ENVIRONMENT {1028DF8183}>
        EXPANDER = #<HEADER {103FD2762B}>
 71: ((:METHOD CLEAVIR-CST-TO-AST::CONVERT-CST (T T TRUCLER:GLOBAL-MACRO-DESCRIPTION T)) #<CLIENT {10085C4743}> #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR (QUOTE TEST-CONDITION) :TEST-SLOT 1..
      Locals:
        CLEAVIR-CST-TO-AST::CLIENT = #<CLIENT {10085C4743}>
        CLEAVIR-CST-TO-AST:CST = #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR 'TEST-CONDITION :TEST-SLOT 1) ..) {102864FF73}>
        CLEAVIR-CST-TO-AST::ENVIRONMENT = #<TRUCLER-REFERENCE:ENVIRONMENT {1028DF8183}>
        CLEAVIR-CST-TO-AST::INFO = #<TRUCLER:GLOBAL-MACRO-DESCRIPTION {1028DF8333}>
 72: ((:METHOD CLEAVIR-CST-TO-AST:CONVERT :AROUND (T T T)) #<CLIENT {10085C4743}> #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR (QUOTE TEST-CONDITION) :TEST-SLOT 1) (TESTABLE-RESTART NIL :REPOR..
      Locals:
        SB-PCL::.NEXT-METHOD-CALL. = #S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD CLEAVIR-CST-TO-AST:CONVERT (T T T))> :PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (3))
        CLEAVIR-CST-TO-AST::CLIENT = #<CLIENT {10085C4743}>
        CLEAVIR-CST-TO-AST:CST = #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (RESTART-CASE (ERROR 'TEST-CONDITION :TEST-SLOT 1) ..) {102864FF73}>
        CLEAVIR-CST-TO-AST::ENVIRONMENT = #<TRUCLER-REFERENCE:ENVIRONMENT {1028DF8183}>
robert-strandh commented 4 years ago

The SICL REPL inside a host Common Lisp system is not meant to be a complete Common Lisp system. In particular, if any literal host string is involved, SICL does not have a way to cope with it. It would be a lot of extra work to turn the REPL into a complete Common Lisp system, and that is not one of the goals at this point.

Harag commented 4 years ago

Ok kewl.