Clojure

[spec] clojure.spec.alpha/exercise-fn should emit a bettor error message when no implementation is found for a symbol

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.9
  • Fix Version/s: Release 1.11
  • Component/s: None
  • Labels:
  • Environment:
    Clojure 1.9.0-alpha17
    test.check 0.10.0-alpha2
  • Patch:
    Code
  • Approval:
    Vetted

Description

Here we get a NullPointerException because although we do have a spec for foo, we don't have an implementation for it, a more descriptive error message would help.

(require '[clojure.spec.alpha :as s])

(s/fdef foo :args (s/cat :x int?) :ret int?)
=> user/foo

(s/exercise-fn `foo)
NullPointerException   clojure.core/apply (core.clj:657)

Proposed: Check for a nil function and throw.

Patch: clj-2190.patch

Activity

Hide
Stuart Halloway added a comment -

If we are going to handle this case, can we also include the name of the offending symbol in the error message?

Show
Stuart Halloway added a comment - If we are going to handle this case, can we also include the name of the offending symbol in the error message?
Hide
Alex Miller added a comment -

The sym-or-f arg is resolved to nil before exercise-fn is invoked, so we have no symbol to report by that point.

Show
Alex Miller added a comment - The sym-or-f arg is resolved to nil before exercise-fn is invoked, so we have no symbol to report by that point.

People

  • Assignee:
    Unassigned
    Reporter:
    Abhirag
Vote (0)
Watch (0)

Dates

  • Created:
    Updated: