Clojure-Intro-Course / babel

MIT License
2 stars 0 forks source link

[Le #126] Print nested args in babel (and other non-macro?) spec errors #42

Open stanislowskij opened 2 months ago

stanislowskij commented 2 months ago

⚠️ Imported from legacy repository. This issue is a duplicate of https://github.com/Clojure-Intro-Course/babel-legacy/issues/126.

babel.middleware=> (even? [(StringBuilder. "a")])
The first argument of (even? [#object[java.lang.StringBuilder 0x3ccd99fd "a"]]) was expected to be a number but is a vector [#object[java.lang.StringBuilder 0x3ccd99fd "a"]] instead.
....
babel.middleware=> (even? (StringBuilder. "a"))
The first argument of (even? "a") was expected to be a number but is a string "a" instead.
stanislowskij commented 2 months ago

Need to check for collapsing ranges in nested expressions.

stanislowskij commented 2 months ago

We need to move collapsing ranges into type-and-val. The current collapsing doesn't work because range-collapse gets a string, not a collection.

stanislowskij commented 2 months ago

Done with babel spec messages, need to handle other spec messages.

stanislowskij commented 2 months ago

I checked by setting up my own function and speccing it. Args are printed correctly. Haven't added this to tests since I'd like to use a more systematic approach to third-party spec testing. I am creating a separate issue for testing for third-party specs. This issues is closed.

stanislowskij commented 2 months ago

Turns out it third party type specs that use clojure.core predicates were treated as babel specs, so we don't know if the args are actually printed correctly for third party specs.

stanislowskij commented 2 months ago

Seems like this was almost done, but not quite. Somebody should be assigned to look at this again and reorganize the issue.