<< Back to previous view

[CTYP-174] More fixes for closed source projects (datomic) Created: 15/Sep/14  Updated: 25/May/15  Resolved: 18/May/15

Status: Closed
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Allen Rohner Assignee: Allen Rohner
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File 0001-More-fixes-for-nses-with-no-source.patch     File ctyp-174-2.diff    

 Description   

CTYP-166 was incomplete. The attached patch gets farther through checking. I haven't gotten an :ok yet w/ my datomic project, so I don't know if this is complete either

The main change is that the line about "checked N lines" now returns 0 for namespaces where we can't find the source.



 Comments   
Comment by Allen Rohner [ 03/Feb/15 4:05 PM ]

I've successfully gotten ':ok' using this patch. Can it get included?

Comment by Ambrose Bonnaire-Sergeant [ 07/Feb/15 2:47 PM ]

Patch doesn't seem to apply

[abonnair@catbert datomic]$ git am --keep-cr -s --ignore-whitespace < 0001-More-fixes-for-nses-with-no-source.patch 
Applying: More fixes for nses with no source
error: patch failed: module-check/src/main/clojure/clojure/core/typed/check_ns_common.clj:89
error: module-check/src/main/clojure/clojure/core/typed/check_ns_common.clj: patch does not apply
Patch failed at 0001 More fixes for nses with no source
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
Comment by Allen Rohner [ 05/Mar/15 12:59 PM ]

It looks like the first didn't apply because the code has drifted. Uploaded a second attempt, ctyp-174-2.diff. It should apply cleanly to master, on its own. The change is very simple, it just returns an empty set for the ns deps for closed source nses. The check-ns run looks like:

WARNING:File for datomic.api not found on classpath: datomic/api.clj
Not checking datomic.api (ns form missing)

Comment by Allen Rohner [ 05/Mar/15 1:02 PM ]

I got an ":ok" with the second patch on a 300 line ns that uses datomic.

Comment by Ambrose Bonnaire-Sergeant [ 18/May/15 3:53 AM ]

Applied, will appear in 0.2.89. Thanks!

https://github.com/clojure/core.typed/commit/e8403409cd7a8c398601ccd779d0f77d94c32cd0

Comment by Mark Wong-VanHaren [ 24/May/15 7:34 PM ]

Might this be related? Thanks!


nickel.core=> (check-ns)
Initializing core.typed ...
Building core.typed base environments ...
Finished building base environments
"Elapsed time: 23016.781 msecs"
core.typed initialized.
Start collecting nickel.core
Start collecting nickel.handler
WARNING: File for datomic.api not found on classpath: datomic/api.clj
WARNING: File for datomic.api not found on classpath: datomic/api.clj
Type Error (nickel/handler.clj:30:45) Internal Error (nickel/handler.clj:30:45) Cannot resolve type: datomic.api/Connection
Hint: Is datomic.api/Connection in scope?
Hint: Has datomic.api/Connection's annotation been found via check-ns, cf or typed-deps?

ExceptionInfo Type Checker: Found 1 error clojure.core/ex-info (core.clj:4403)


Comment by Ambrose Bonnaire-Sergeant [ 24/May/15 8:11 PM ]

No, now we need a set of annotations for datomic.api. Perhaps Allen has some he might open source?

Comment by Mark Wong-VanHaren [ 25/May/15 4:43 AM ]

Ah, I see. Thanks, Ambrose! (I've only started working with core.typed yesterday, so I'm pretty ignorant, but also really jazzed about it. Thanks!)

Comment by Allen Rohner [ 25/May/15 11:08 AM ]

My datomic annotations are pretty basic atm: https://gist.github.com/arohner/d7a6bb057824c224b5b3

That was enough to get me started, but note that d/q returns Any, so you'll have to use something like primsatic/schema if you want to check the results of a query.





[CTYP-220] Data generator for a type Created: 22/May/15  Updated: 22/May/15

Status: Open
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: victor chung Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I would like to have a function gen-data which, given any type, generates a random instance of that type.
For example, we have a type:

(t/defalias Move
"A legal move in rock-paper-scissors"
(t/U ':rock ':paper ':scissors))

then (gen-data Move) would give any of :rock :paper or :scissors.



 Comments   
Comment by victor chung [ 22/May/15 3:59 AM ]

This is useful when you are doing exploratory things in a repl.

Comment by Ambrose Bonnaire-Sergeant [ 22/May/15 4:05 AM ]

Is there a test.check or data.generators API we can reuse?





[CTYP-219] RPS example does not type check Created: 22/May/15  Updated: 22/May/15

Status: Open
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: victor chung Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: None
Environment:

osx
clojure 1.6



 Description   

Code is here:

https://gist.github.com/kindlychung/9f932ae4c9b752f87431



 Comments   
Comment by victor chung [ 22/May/15 2:57 AM ]

How do I edit an issue?
Sorry, this should have been marked as defect instead of enhancement.





[CTYP-218] wrap-clj-repl causes error Created: 20/May/15  Updated: 21/May/15

Status: Open
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: victor chung Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: None
Environment:

java 1.8
osx



 Description   

Add the following line into project.clj:

:repl-options {:nrepl-middleware [clojure.core.typed.repl/wrap-clj-repl]}

and start a nrepl server, i get this error:

Error loading clojure.core.typed.repl: java.io.FileNotFoundException: Could not locate clojure/tools/analyzer/env__init.class or clojure/tools/analyzer/env.clj on classpath: , compiling:(clojure/core/typed/analyze_clj.clj:1:1)
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: clojure.core.typed.repl/wrap-clj-repl in this context, compiling/private/var/folders/5d/44ctbbln4dsflgzxph1dm8wr0000gn/T/form-init7445852488836639804.clj:1:2354)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6651)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3719)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6646)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3719)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6646)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.access$100(Compiler.java:38)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6050)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6644)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5217)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3846)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6642)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.eval(Compiler.java:6700)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: java.lang.RuntimeException: Unable to resolve var: clojure.core.typed.repl/wrap-clj-repl in this context
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:659)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6644)
... 38 more

The whole project.clj file:

(defproject typed-clj-test "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[org.clojure/core.typed "0.2.92"]]
:main ^:skip-aot typed-clj-test.core
:repl-options {:nrepl-middleware [clojure.core.typed.repl/wrap-clj-repl]}
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/May/15 7:46 PM ]

Add `:exclusions [org.clojure/tools.analyzer.jvm]` to your core.async dependency. core.async depends on an ancient version.

Comment by victor chung [ 21/May/15 9:11 AM ]

Maybe we should submit an issue at their github repo?





Generated at Wed May 27 23:27:45 CDT 2015 using JIRA 4.4#649-r158309.