core.logic

spec detects error in -inc macro

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Clojure 1.9.0-alpha12
  • Patch:
    Code

Description

As reported on the Clojure mailing list by Burt:

with "1.9.0-alpha10" and core.logic "0.8.10":

(ns lwb.nd.rules
(:refer-clojure :exclude [==])
(:require [clojure.core.logic :refer :all]))
=> nil

with "1.9.0-alpha12" and core.logic "0.8.10":

(ns lwb.nd.rules
(:refer-clojure :exclude [==])
(:require [clojure.core.logic :refer :all]))
CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/fn did not conform to spec:
In: [0] val: clojure.core.logic/-inc fails spec: :clojure.core.specs/arg-list at: [:args :bs :arity-1 :args] predicate: vector?
In: [0] val: clojure.core.logic/-inc fails spec: :clojure.core.specs/args+body at: [:args :bs :arity-n] predicate: (cat :args :clojure.core.specs/arg-list :prepost (? map?) :body (* any?))
:clojure.spec/args (clojure.core.logic/-inc [] (bind (this) g))
#:clojure.spec{:problems ({:path [:args :bs :arity-1 :args], :pred vector?, :val clojure.core.logic/-inc, :via [:clojure.core.specs/args+body :clojure.core.specs/arg-list :clojure.core.specs/arg-list], :in [0]} {:path [:args :bs :arity-n], :pred (cat :args :clojure.core.specs/arg-list :prepost (? map?) :body (* any?)), :val clojure.core.logic/-inc, :via [:clojure.core.specs/args+body :clojure.core.specs/args+body], :in [0]}), :args (clojure.core.logic/-inc [] (bind (this) g))}, compiling:(clojure/core/logic.clj:1130:5)

Activity

Hide
Steve Miner added a comment -

It looks like the problem is with the macro -inc. It should quote the internal fn name so that it stays an unqualified symbol during macro expansion.

Show
Steve Miner added a comment - It looks like the problem is with the macro -inc. It should quote the internal fn name so that it stays an unqualified symbol during macro expansion.
Hide
Steve Miner added a comment -

Macro needs to protect internal name of fn during expansion.

Show
Steve Miner added a comment - Macro needs to protect internal name of fn during expansion.
Hide
Steve Miner added a comment -
Show
Steve Miner added a comment - The same fix was recently committed by puredanger. https://github.com/clojure/core.logic/commit/29917372ef066c42ca362e3a94f68d620ddd1b56

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: