ruricolist / cl-yesql

Common Lisp library for using SQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IMPORT: The value :AS is not of type LIST

phoe opened this issue · comments

With cl-yesql from Quicklisp master, when trying to evaluate the following form:

(import system/player
  :from "system/player.sql"
  :as :cl-yesql/postmodern
  :binding  :all-as-functions
  :export-bindings t)

I get the following error:

The value
  :AS
is not of type
  LIST
   [Condition of type TYPE-ERROR]

Backtrace:
  0: ((LAMBDA (VERNACULAR/LANG:LANG VERNACULAR/IMPORTING::SOURCE VERNACULAR/IMPORTING::BINDINGS) :IN IMPORT) :CL-YESQL/POSTMODERN #P"/home/phoe/Projects/Lisp/Gateway/src/server/db/sql/src/yesql/system/p..
      Locals:
        VERNACULAR/IMPORTING::BINDINGS = ((#':SELECT-PLAYER-BY-ID :AS #'GATEWAY.SQL/SYSTEM::SELECT-PLAYER-BY-ID) (#':SELECT-PLAYER-BY-LOGIN :AS #'GATEWAY.SQL/SYSTEM::SELECT-PLAYER-BY-LOGIN) ..)
        VERNACULAR/LANG:LANG = :CL-YESQL/POSTMODERN
        VERNACULAR/IMPORTING::SOURCE = #P"/home/phoe/Projects/Lisp/Gateway/src/server/db/sql/src/yesql/system/player.sql"
  1: ((FLET SB-IMPL::PERFORM-EXPANSION :IN MACROEXPAND-1) #<FUNCTION (MACRO-FUNCTION IMPORT) {533E48AB}> NIL)
...

Is that possibly related to the fact that the bindings local var contains :AS symbols as the second elements of the binding forms, but there is a part that expects these to instead be lists?

       ;; Fetch the symbols from bindings and export them.
       ,@(when export-bindings
           (let ((symbols (mapcar (compose #'second #'second) bindings)))
             `((export ',symbols))))

Can confirm - commenting out :export-bindings t works around this issue and allows this form to compile properly.

Fixed by replacing (compose #'second #'second) by (compose #'second #'third).

       ;; Fetch the symbols from bindings and export them.
       ,@(when export-bindings
           (let ((symbols (mapcar (compose #'second #'third) bindings)))
             `((export ',symbols))))