Skip to content

False positive on splice compile error #1687

@edsrzf

Description

@edsrzf

The code below produces the error:

compile error: splice can only be used in function parameters and data constructors, it has no effect here
(do (def (n) [(splice [])]) n)

(The original code was a let, which I reduced, and this is the expansion.)

I believe this is a false positive, since the splice form is in a data constructor. These variations of the code don't cause the error:

(def (n) [(splice [])]) n       # no do wrapper
(do (def n [(splice [])]) n)    # no destructuring 
(do (def (n) [1(splice [])]) n) # extra element before the splice

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis is not expected behavior, and needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions