ClojureScript

cljs.compiler: No defmethod for emit-constant clojure.lang.LazySeq

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

The cljs compiler errors when trying to emit-constant for a clojure.lang.LazySeq.

Example : https://www.refheap.com/paste/3901

Here syms is defined as a LazySeq on line 3, then on line 7 it is quoted. The error is included in the refheap.

Emitting a cljs.core.list for this type seems to solve the issue.

Activity

Hide
David Nolen added a comment -

This approach seems acceptable but this is an old patch can we update for master?

Show
David Nolen added a comment - This approach seems acceptable but this is an old patch can we update for master?
Hide
Herwig Hochleitner added a comment -

Attached patch 0001 doesn't add a case for LazySeq, but folds two cases for PersistentList and Cons into one for ISeq.

Show
Herwig Hochleitner added a comment - Attached patch 0001 doesn't add a case for LazySeq, but folds two cases for PersistentList and Cons into one for ISeq.
Hide
Herwig Hochleitner added a comment -

The lazy seq seems to be introduced on line 7, the '~syms form

`(let [mappings# (into {} (map-indexed #(identity [%2 %1]) '~syms))

Clojure allows lazy-seqs to be embedded: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L4538

As an aside: The relevant protocol is not literality, but the print-dup multimethod. Do / Should we have print-dup in CLJS?

Show
Herwig Hochleitner added a comment - The lazy seq seems to be introduced on line 7, the '~syms form
`(let [mappings# (into {} (map-indexed #(identity [%2 %1]) '~syms))
Clojure allows lazy-seqs to be embedded: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L4538 As an aside: The relevant protocol is not literality, but the print-dup multimethod. Do / Should we have print-dup in CLJS?
Hide
David Nolen added a comment -

Can you identify precisely where a LazySeq is getting emitted here? A LazySeq is not literal so this seems like a bug in the macro to me. I could be wrong. Thanks!

Show
David Nolen added a comment - Can you identify precisely where a LazySeq is getting emitted here? A LazySeq is not literal so this seems like a bug in the macro to me. I could be wrong. Thanks!

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: