Thanks Bost.

To workaround the need to delete annotations, manually add these requires 
to your ns form.
You can choose whatever alias name you want.

(:require [clojure.core.typed :as t]
          [clojure.spec.alpha :as s])

Thanks,
Ambrose

On Friday, October 13, 2017 at 6:56:34 PM UTC-4, Bost wrote:
>
> A hint to a casual reader just trying stuff out: 
>
> $ lein new hello 
> $ cd hello 
> # added {:user {:plugins [[lein-typed "0.4.2"]]}} to ~/.lein/profiles.clj 
> # added [org.clojure/core.typed "0.4.2"] to project.clj 
> $ lein typed infer-type hello.core 
> CompilerException java.lang.RuntimeException: No such namespace: t, 
> compiling:(hello/core.clj:5:1) 
> clojure.lang.Compiler.analyze (Compiler.java:6688) 
> clojure.lang.Compiler.analyze (Compiler.java:6625) 
> clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3766) 
> clojure.lang.Compiler.analyzeSeq (Compiler.java:6870) 
> clojure.lang.Compiler.analyze (Compiler.java:6669) 
> clojure.lang.Compiler.analyze (Compiler.java:6625) 
> clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:6001) 
> clojure.lang.Compiler$FnMethod.parse (Compiler.java:5380) 
> clojure.lang.Compiler$FnExpr.parse (Compiler.java:3972) 
> clojure.lang.Compiler.analyzeSeq (Compiler.java:6866) 
> clojure.lang.Compiler.analyze (Compiler.java:6669) 
> clojure.lang.Compiler.eval (Compiler.java:6924) 
> Caused by: 
> RuntimeException No such namespace: t 
> clojure.lang.Util.runtimeException (Util.java:221) 
> clojure.lang.Compiler.resolveIn (Compiler.java:7134) 
> clojure.lang.Compiler.resolve (Compiler.java:7108) 
> clojure.lang.Compiler.analyzeSymbol (Compiler.java:7069) 
> clojure.lang.Compiler.analyze (Compiler.java:6648) 
> clojure.lang.Compiler.analyze (Compiler.java:6625) 
>
> You need to: 
> 1. Remove the [org.clojure/clojure "1.8.0"] from project.clj 
> 2. Undo the changes in src/hello/core.clj 
>
> And then it will work: 
>
> $ lein typed infer-type hello.core 
> Initializing core.typed ... 
> Building core.typed base environments ... 
> Finished building base environments 
> "Elapsed time: 2829.892198 msecs" 
> core.typed initialized. 
> Refreshing runtime inference 
> Instrumenting def init hello.core/foo in hello.core 
>
> Testing hello.core-test 
>
> FAIL in (a-test) (core_test.clj:7) 
> FIXME, I fail. 
> expected: (= 0 1) 
>   actual: (not (= 0 1)) 
>
> Ran 1 tests containing 1 assertions. 
> 1 failures, 0 errors. 
> Inferring types for hello.core ... 
> Aliasing clojure.core.typed as t in hello.core 
> generate-tenv: 1 infer-results 
> finished squash-horizonally 
> Start follow-all 
> end follow-all 
> start remove unreachable aliases 
> end remove unreachable aliases 
> done populating 
> Output annotations to  #object[java.net.URL 0x738a39cc 
> file:/tmp/hello/src/hello/core.clj] 
> Finished inference, output written to hello.core 
>
>
>
> 2017-10-13 23:46 GMT+02:00 Ambrose Bonnaire-Sergeant <ilike...@gmail.com 
> <javascript:>>: 
> > This is pretty much the extent of my macro heuristics: binding forms are 
> > often the first argument, and it's usually a vector. Also, [& body] 
> > arguments 
> > are common. 
> > 
> > 
> > On Friday, October 13, 2017 at 5:44:07 PM UTC-4, Ambrose 
> Bonnaire-Sergeant 
> > wrote: 
> >> 
> >> Potentially. Actually, it currently instruments and gathers data about 
> >> macros, but doesn't 
> >> output them because I haven't thought of very good heuristics to guess 
> >> specs for common 
> >> macros (in particular heterogeneous/repeating lists and vectors are 
> >> troublesome, I haven't 
> >> tried outputting any spec regex ops). 
> >> 
> >> Thanks, 
> >> Ambrose 
> >> 
> >> On Friday, October 13, 2017 at 3:54:22 PM UTC-4, Colin Fleming wrote: 
> >>> 
> >>> This looks great! Can this be used to infer macro specs based on 
> examples 
> >>> of usage? 
> >>> 
> >>> On 14 October 2017 at 04:30, Ambrose Bonnaire-Sergeant 
> >>> <abonnair...@gmail.com> wrote: 
> >>>> 
> >>>> Hi, 
> >>>> 
> >>>> Happy to announce a new set of tools to automatically 
> >>>> generate types and specs for your projects. 
> >>>> 
> >>>> Dependency information: 
> >>>> 1. core.typed 
> >>>>     [org.clojure/core.typed "0.4.2"] 
> >>>> 2. lein-typed 
> >>>>     [lein-typed "0.4.2"] 
> >>>> 3. boot-typedclojure 
> >>>>   [org.typedclojure/boot-typedclojure "0.1.0"] 
> >>>> 
> >>>> Tutorial: 
> >>>> Here's how to try it out (for Lein projects using clojure.test): 
> >>>> 
> >>>> 1. Add {:user {:plugins [[lein-typed "0.4.2"]]}} to your 
> >>>> ~/.lein/profiles.clj 
> >>>> 2. Add a runtime dependency to [org.clojure/core.typed "0.4.2"] in 
> your 
> >>>> chosen Lein project.clj 
> >>>> 3. To infer specs: Run lein typed infer-spec <insert-ns> 
> >>>> 4. To infer types: Run lein typed infer-type <insert-ns> 
> >>>> 
> >>>> WARNING: This tool rewrites your files. Only try with backed up code. 
> >>>> 
> >>>> Some examples: 
> >>>> clj-time: 
> >>>> - Spec setup + spec results 
> >>>> - Types setup + types results 
> >>>> 
> >>>> cheshire 
> >>>> - Spec setup + spec results 
> >>>> - Types setup + types results 
> >>>> 
> >>>> (Note: use the latest core.typed versions to reproduce on your 
> machines) 
> >>>> 
> >>>> Hints: 
> >>>> This tool instruments your namespace and runs your test suite. This 
> >>>> can be expensive. Try these options: 
> >>>> 
> >>>>    Choose lein test selectors (here: [:integration :generative] 
> >>>> selectors) 
> >>>>   lein typed infer-spec <insert-ns> :test-selectors "[:integration 
> >>>> :generative]" 
> >>>> 
> >>>>    Timeout individual tests (1000ms timeout) 
> >>>>   lein typed infer-spec <insert-ns> :test-timeout-ms 1000 
> >>>> 
> >>>> If annotation generation hangs, try these options: 
> >>>> 
> >>>>    Disable recursive type inference 
> >>>>   lein typed infer-spec <insert-ns> :infer-opts 
> "{:no-squash-vertically 
> >>>> true}" 
> >>>> 
> >>>> If you see "No such namespace: s", try deleting existing 
> automatically 
> >>>> generated specs/types before regenerating them. (git checkout works 
> well 
> >>>> here) 
> >>>> 
> >>>> 
> >>>> 
> >>>> Reply with your generated specs & types! 
> >>>> 
> >>>> Thanks, 
> >>>> Ambrose 
> >>>> 
> >>>> -- 
> >>>> You received this message because you are subscribed to the Google 
> >>>> Groups "Clojure" group. 
> >>>> To post to this group, send email to clo...@googlegroups.com 
> >>>> Note that posts from new members are moderated - please be patient 
> with 
> >>>> your first post. 
> >>>> To unsubscribe from this group, send email to 
> >>>> clojure+u...@googlegroups.com 
> >>>> For more options, visit this group at 
> >>>> http://groups.google.com/group/clojure?hl=en 
> >>>> --- 
> >>>> You received this message because you are subscribed to the Google 
> >>>> Groups "Clojure" group. 
> >>>> To unsubscribe from this group and stop receiving emails from it, 
> send 
> >>>> an email to clojure+u...@googlegroups.com. 
> >>>> For more options, visit https://groups.google.com/d/optout. 
> >>> 
> >>> 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> <javascript:> 
> > Note that posts from new members are moderated - please be patient with 
> your 
> > first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com <javascript:> 
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to clojure+u...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to