<< Back to previous view

[CTYP-116] Apply doesn't work with dotted arguments Created: 11/Mar/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Gary Fredericks Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None

Attachments: File apply.diff    

 Description   

This code:

(t/ann foo (All [x y ...] [[y ... y -> x] -> [y ... y -> x]]))
(defn foo
  "Doesn't do anything useful."
  [f]
  (let [mem (memoize (fn [& args] #(apply f args)))]
    (fn [& args]
      ((apply mem args)))))

On type-check throws this exception:

AssertionError Assert failed: (not (some :drest (:types fin)))  clojure.core.typed.check/relevant-Fns (check.clj:2661)

I'm using core.typed version 0.2.36.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 11/Mar/14 10:31 PM ]

I suspect minimal case is:

(cf (fn [f & args] (apply f args)) (All [b ...] [[b ... b -> Any] b ... b -> Any]))
Comment by Gary Fredericks [ 11/Mar/14 10:35 PM ]

Indeed I get the same error with that snippet.

Comment by Di Xu [ 18/Apr/14 9:25 PM ]

seems solved this problem

Comment by Ambrose Bonnaire-Sergeant [ 01/May/14 2:15 PM ]

Need to look at this closer, but it seems line 63 completely ignores rest/drest types.

Comment by Di Xu [ 04/May/14 2:34 AM ]

Oops, that's an error. I added to see how it works, forget to delete it.

The main problem with this patch is it assume user invoke apply with argument that just like declared function type, for example:

(t/ann foo (All [x ...] [Number String x ... x -> bar]))

and invoke with

(apply foo 1 "bar" local-variable)

not

(apply foo 1 local-variable-with-string-in-first)

but I assume this should be the typical usage of apply, no?

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 11:20 PM ]

This now has a readable error actually relevant to the problem, as of 0.2.58





[CTYP-70] Having trouble typing core.string/blank? Created: 24/Sep/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Julian Birch Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

(ns moonrise
(:require [clojure.core.typed :refer :all]
[clojure.string :as s]))

(cf (ann core.string/blank? [String -> Boolean]))

(ann x [String -> Boolean])
(defn x [s] (s/blank? s))

Fails.

Apologies if this is wrong.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 25/Sep/13 3:12 AM ]

I think core.string/blank? should be clojure.string/blank?. Also cf is not allowed inside a typed file.

Comment by Julian Birch [ 28/Sep/13 2:58 PM ]

Clunk. You're absolutely right. Assuming there's no (cf) there, is there any way you could log an error for an annotation with no associated actual definition? Obviously, to be useful, it'd have to appear in the appropriate location in the file.

Comment by Ambrose Bonnaire-Sergeant [ 28/Sep/13 10:16 PM ]

I don't know. Perhaps at the end of type checking a namespace I can check if a var exists for each annotation. I don't think it's really feasible for REPL development though.





[CTYP-75] More accurate Long arithmetic Created: 30/Sep/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Enhancement Priority: Major
Reporter: Chris Spencer Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File better-arithmetic.patch     Text File long-arithmetic.patch    

 Description   

The basic operations +*- do not autopromote, so it's safe to assume that an operation on Longs will remain a Long (or throw an exception)



 Comments   
Comment by Chris Spencer [ 30/Sep/13 3:55 AM ]

Attached better-arithmetic which supersedes the other patch. Adds better type preservation/inference for Longs and Doubles through arithmetic.

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 11:11 PM ]

Most ops now have Long/Double arities https://github.com/clojure/core.typed/blob/master/module-check/src/main/clojure/clojure/core/typed/base_env.clj#L1074





[CTYP-59] Return accurate type from first for heterogenous vectors Created: 14/Sep/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Enhancement Priority: Minor
Reporter: Chris Spencer Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

(first [1 'a]) currently typed as (U (Value a) (Value 1)) rather than (Value 1)



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 11:08 PM ]

Fixed in CTYP-142: http://dev.clojure.org/jira/browse/CTYP-142





[CTYP-58] nth can't be used on Sets, but type checks as ok Created: 14/Sep/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Minor
Reporter: Chris Spencer Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

(nth #{5} 4) checks as ok, but fails at runtime. Just need a more accurate type for nth.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 11:05 PM ]

Fixed sometime before 0.2.59 https://github.com/clojure/core.typed/blob/master/module-check/src/test/clojure/clojure/core/typed/test/core.clj#L2966-2972





[CTYP-63] ann-record should accept optional binder Created: 16/Sep/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

ann-precord should be deprecated and consolidated with ann-record.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 11:03 PM ]

Fixed sometime before 0.2.59





[CTYP-81] clojure.core.async/alts!! fails to check when used with any keyword arguments Created: 03/Oct/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Michael Hanson Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

clojure.core.typed 0.2.13



 Description   

Using alts!! as (alts!! [(chan) (chan)] :priority true) or (alts!! [(chan) (chan)] :priority true :default nil) fails to check, stating that an uneven number of keyword arguments were provided to the function. Removing the keyword arguments checks :ok.

See https://gist.github.com/mybuddymichael/f584ab905a4165f273e6 for the simple test case and repl output.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 11:02 PM ]

Fixed https://github.com/clojure/core.typed/commit/3ab1c12b8e4617a1a65683bb539afcc70793f299





[CTYP-155] Unit test that might be doing nothing Created: 12/Jun/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Enhancement Priority: Trivial
Reporter: Andy Fingerhut Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

In namespace clojure.core.typed.test.parse-unparse-test the following test appears to be calling = with 1 argument, which always returns true:

(is-clj (= (clj (-> (unparse-type (parse-type `(t/TFn ~'[[a :variance :covariant]] ~'a)))
                      next)
             (quote ([[a :variance :covariant]] a)))))


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:57 AM ]

Thanks fixed.





[CTYP-107] automatic pre- and post-conditions for unchecked code Created: 19/Feb/14  Updated: 20/Jul/14  Resolved: 27/Feb/14

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

Type: Enhancement Priority: Minor
Reporter: Cees van Kemenade Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

Currently it is fairly difficult to use core.typed to achieve/ensure production quality code. Often it happens that part of your own code does not pass the core.typed checker. Of course you can add the :no-check to your function, but in that case all type-checking is bypassed for this function and it can inject arbitrary data into the rest of your program (the type-signature is not enforced anymore.

It would be possible to prevent this issue if core.typed offered the opportunity to derive pre- and post-conditions based on the type-signature. This way unchecked code would use run-time checking as a fall-back scenario to prevent unchecked code could inject arbitrary data into the rest of your program (like the schema-library by prismatic, but using the core.typed annotations instead of schemas).
One step beyond would be to:
1. Use dynalint for the unchecked code (if this is possible)
2. Generate wrappers with pre- and post-conditions for external libaries.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 19/Feb/14 7:08 AM ]

This is highly desirable. Typed Racket does an excellent job, so it's simple enough to follow their lead.

The biggest issue is actually the time it takes to load the type checker. I don't want to impose this on anyone who isn't generating contracts from types.

I've pondered writing a simpler intermediate AST representation of types that requires no further loading of the type system. It would look very much like the output of tools.analyzer or CLJS analysis. When a global annotation is added, it would be converted to an AST (very cheaply). Converting this AST to a contract would be less robust than using the type manipulating utilities of the full type checker, but the idea is that a type contract might generate incorrectly, but a "check-ns" always tells you after the fact.

It sucks, but some people rely on the zero load-time of core.typed (it's a pretty sweet property too!).

In short, I've thought a lot about this, and it's a glaring missing component in a gradual type system.

Comment by Cees van Kemenade [ 19/Feb/14 1:37 PM ]

I can imagine the dilemma. Core-typed has zero slow-down as all checking is taken off-line. I can image that the launch of the type-system at runtime is a significant overhead. To prevent this overhead the preparations of the type-checking should be brought to compile-time. Your suggestion of generating AST representations does this.

I was considering generation of source-code at compile time to generate ordinary pre- and post-conditions, or to wrap a function symbol with some checks. However, it seemed to be less than trivial to locate where the ann-macro store the type-annotations. I suppose the limited documention on this type of internal.

I guess the manual insertion of clojure pre- and post-conditions on unchecked functionscurrently is the best way out for the time being.

Comment by Ambrose Bonnaire-Sergeant [ 27/Feb/14 8:46 AM ]

Added clojure.core.typed/pred in 0.2.34. This is about as good as it's going to get for now.

Comment by Cees van Kemenade [ 28/Feb/14 2:31 AM ]

Thanks, this is a great tool to implement a postcondition for a function that has a ^:no-check directive. This way you can prevent that unchecked functions insert incorrect data into your process-flow.
Cool!

Comment by Cees van Kemenade [ 04/Mar/14 2:58 PM ]

Note:
When using this I noticed that (core.typed/pred T) returns an internal error when your type is (Seqable X) or your type contains a (Seqable X) somewhere at a nested level.

However, doing the transformation (Seqable X) --> (core.typed/Coll X)
works nicely.





[CTYP-97] 0.2.16 seems to introduce a bug Created: 14/Nov/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: kshramt Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

core.typed 0.2.16 and later



 Description   

Some changes introduced by core.typed-0.2.16 seems to cause `Type Error (sicp.err:49:13) Cannot resolve type: a` for following code.

0.2.15: :ok
0.2.16: error
0.2.17: error
0.2.18: error
0.2.19: error

$ lein typed check sicp.err
Initializing core.typed ...
Loading Clojurescript...
Clojurescript not found
"Elapsed time: 3130.848 msecs"
core.typed initialized.
Start collecting sicp.err
Finished collecting sicp.err
Collected 1 namespaces in 3293.048 msecs
Start checking sicp.err
Type Error (sicp.err:49:13) Cannot resolve type: a
Hint: Is a in scope?
Hint: Has a's annotation been found via check-ns, cf or typed-deps?
Found errors
Subprocess failed
(ns sicp.err
  (:require [clojure.test :refer [is are]]
            [clojure.core.typed :refer [ann fn>
                                        Seqable] :as typed])
  (:import (clojure.lang ASeq LazySeq)))


(ann reduce_ (All [a b] (Fn [[a b
                              -> b]
                             b
                             (Seqable a)
                             -> b]
                            [[a (Seqable (U a b))
                              -> (Seqable (U a b))]
                             (Seqable (U a b))
                             (Seqable a)
                             -> (Seqable (U a b))])))
(defn reduce_
  {:test #(do (is (= (reduce_ +' 0 [1 2]) 3))
              (is (= (reduce_ / 1 [2 3]) 2/3)))}
  [f zero coll]
  (if-let [s (seq coll)]
    (f (first s)
       (reduce_ f zero (rest s)))
    zero))

(ann append_ (All [a b] [(Seqable a) (Seqable b) -> (U (Seqable (U a b))
                                                       (ASeq (U a b)))]))
(defn append_
  [coll1 coll2]
  (reduce_ cons coll2 coll1))


; -------- main

; if you comment out this function, you will get :ok
(ann map-1 (All [a b] [[a -> b] (Seqable a)
                       -> (LazySeq b)]))
(defn map-1 [f coll]
  (lazy-seq
   (if-let [s (seq coll)]
     (cons (f (first s))
           (map-1 f (rest s))))))

(ann map-2 (All [a b] [[a -> b] (Seqable a) -> (LazySeq b)]))
(defn map-2
  [f coll]
  (lazy-seq
   (reduce_ (fn> [x :- a ; ERROR!! -- Cannot resolve type: a
                  y :- (Seqable b)]
              (append_ [(f x)] y))
            []
            coll)))


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 14/Nov/13 7:58 PM ]

Ah, that's not surprising. I overhauled the scoping for type variables, forgot this case.

Thanks for the report.

Comment by vladimir [ 18/Mar/14 12:55 PM ]

Hello,

still got the same on 0.2.38.. is it closed because fixed?

Regards,

Vladimir

Comment by Ambrose Bonnaire-Sergeant [ 18/Mar/14 1:18 PM ]

Added passing test for CTYP-97 https://github.com/clojure/core.typed/commit/614244afc482826b650e0ebd14892f0ebbc411a0

Comment by Ambrose Bonnaire-Sergeant [ 18/Mar/14 1:19 PM ]

Vladimir,

Please elaborate on your issue.

Thanks
Ambrose





[CTYP-128] Trim down the AOT jar Created: 28/Mar/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Task Priority: Trivial
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Declined Votes: 0
Labels: None


 Description   

Started some work here https://github.com/clojure/core.typed/commit/d5c1d23f15301100e36f0290df43ad09e4b377d1

All tests started failing.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:54 AM ]

Clojure doesn't make this easy by any means.





[CTYP-117] Getting deprecated warning with fn> Created: 12/Mar/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Task Priority: Trivial
Reporter: Brian Zwahr Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

Via instructions from Twitter, I'm creating this ticket. When running lein typed check against a function using fn>, I'm getting a deprecated warning message. You can see the code and message here:

https://gist.github.com/echosa/9508942



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 01/May/14 2:17 PM ]

That syntax is deprecated, wherever you copied that style of nested vectors in fn> should be updated. Do you remember which docs suggested that syntax?

Comment by Brian Zwahr [ 04/May/14 12:34 PM ]

I do not remember. I've been looking through to try and find it again, but I can seem to. There's a chance this was homegrown code that I wrote incorrectly due to my (continuing) lack of understanding of typed Clojure. Was this deprecated even a couple months ago when I was trying it?

So, what would be the proper way to do this?

I'll continue looking for any references to this type of code and will report them if I find them.

Comment by Ambrose Bonnaire-Sergeant [ 04/May/14 10:51 PM ]

You don't need vectors around each parameter annotation.





[CTYP-55]  clojure.lang.RT/longCast is interpreted incorrectly Created: 11/Sep/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Minor
Reporter: Chris McDevitt Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: bug


 Description   

tested version: 0.2.5

Functions that cast to long like neg? / pos? don't work with type checking. eg. (cf (pos? (dec 1)))

> (cf (long (dec 1)))

Type Error (myapp.core:1:5) Type mismatch:

Expected: 	long

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


 Comments   
Comment by Chris McDevitt [ 11/Sep/13 12:03 PM ]

workaround is (cf (#'pos? (dec 1)))

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:50 AM ]

Fixed sometime before 0.2.58





[CTYP-158] Bogus deprecation messages from core.typed Created: 17/Jun/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Minor
Reporter: Daniel Ziltener Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

"DEPRECATED SYNTAX (client/reactive.clj): Any syntax is deprecated, use clojure.core.typed/Any" - Um, sure?



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 18/Jun/14 3:47 AM ]

There are quite a few of these messages I need to stamp out. What version are you on, and does any particular code trigger it?

Comment by Daniel Ziltener [ 18/Jun/14 5:39 AM ]

I'm on version 0.2.51. There are other such messages, especially core.typed itself triggers a lot of "U syntax is deprecated, use clojure.core.typed/U" messages.

Comment by Sean Corfield [ 25/Jun/14 11:33 AM ]

Repro for 0.2.52:

  • lein new app typed-test
  • edit project.clj and add [org.clojure/core.typed "0.2.52"] as a dependency and {{:plugins [[lein-typed "0.3.4"]]}}
  • edit src/typed_test/core.clj and add {{(:require [clojure.core.typed])}}
  • run lein typed check typed-test.core

You get this output:

DEPRECATED SYNTAX (typed_test/core.clj): Any syntax is deprecated, use clojure.core.typed/Any

This comes from parse-unparse/parse-type-symbol 'Any but I haven't been able to figure out what triggers it yet. It's clearly not triggered by anything in user code tho' since it happens even when user code does not mention Any.

Comment by Sean Corfield [ 25/Jun/14 11:41 AM ]

Found it: line 58 of analyze_clj.clj uses ~'Any but it should use T/Any.

I made that one change locally and installed 0.2.53-SNAPSHOT and the warning goes away for my test case when I depend on the snapshot.

Comment by Ambrose Bonnaire-Sergeant [ 02/Jul/14 8:55 AM ]

I believe I stamped out all of these bogus messages in 0.2.53. Please let me know.

Comment by Sean Corfield [ 02/Jul/14 5:53 PM ]

I no longer see any deprecation warnings with 0.2.53 against our codebase. Thank you!





[CTYP-31] Error with unannotated datatypes. Created: 23/Jul/13  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Alan Busby Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

[org.clojure/core.typed "0.1.17"]



 Description   

From mail;
> > > Hmm. Is LocalConnection a datatype? What's the error you get?
> >
> > This: (t/ann ^:nocheck datomic.api/connect [String -> datomic.peer.LocalConnection])
> > Produces: AssertionError Assert failed: ((u/array-map-c? symbol? (some-fn Scope? Type?)) fields) clojure.core.typed.type-rep/->DataType (type_rep.clj:265)
>
> Thanks.
>
> core.typed doesn't like unannotated datatypes right now. This is probably a defect, please open a ticket.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:45 AM ]

I believe this is more graceful now.





[CTYP-106] Else branch does not tighten scope to non-sequential Created: 19/Feb/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Cees van Kemenade Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None

Attachments: File failDerive1a.clj     File failDerive1.clj    

 Description   

This error is related to the example longOptions.clj of CTYPE-102 and the derived hmap/big-options mentioned as CTYPE-99. I've prepared a new example to clearly show the issue.

The first function passes type-checking. However, it contains a redundant check on line 83 and a redundant base-case on line 85.

The second function does not pass the (check-ns) as it assumes that notifs can be a (seqable String). However, as this is the else-branch of line 112 (if (or (sequential? notifs) (seq? notifs) (vector notifs)) ... so the notifs can not be a (Seqable String) in this branch.

NOTE: core.typed does not know clojure.core/sequential? yet. Therefore the seq? and vector? tests are added too.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 19/Feb/14 5:03 AM ]

Seqable doesn't extend Sequential, ISeq or IPersistentVector, so it's expected that this fails.

I suspect that the type for :st_notif is always an immutable clojure collection? If so, annotate :st_notif as (U (t/Coll String) String nil), and use (coll? notifs) as the predicate. Otherwise, try (not (string? notifs)) as the predicate.

Comment by Cees van Kemenade [ 19/Feb/14 2:18 PM ]

I tried to turn it into clojure.core.typed/Coll and that worked fine.
Thanks for the suggestion/solution!

Out of curiosity I tried as an alternative to check for (= (class notifs) clojure.lang.Seqable) as a second solution, but that did not solve the issue.
So I will stick to solution 1.

Comment by Ambrose Bonnaire-Sergeant [ 19/Feb/14 7:21 PM ]

= isn't useful for narrowing types, especially in the else branch. instance? and isa? would be more useful.

Comment by Cees van Kemenade [ 20/Feb/14 9:48 AM ]

Sorry, it was a typo from my side. I used (isa? ....) see line 166 of the attached fail failDerive1a.clj
This code triggers a type-error on line 171.

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:42 AM ]

I think this is resolved.





[CTYP-114] Should blame correct line number if alias introduces a type error Created: 06/Mar/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   
(def-alias Foo
  '{:a (atom Number)}) ;; this resolves to clojure.core/atom, which doesn't trigger a type error yet

(t/ann f [-> Foo])
(defn f [a]
  a)  ; we get the type error here, blaming `f`.


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:39 AM ]

Fixed sometime before 0.2.58





[CTYP-123] Using clojure.core.typed.async requires calling typed-deps Created: 16/Mar/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Gary Fredericks Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

0.2.38-20140315.151412-2



 Description   

The following code will only type check if (t/typed-deps clojure.core.typed.async) is added below the ns form:

(ns controller.tmp
  (:require [clojure.core.async :as a]
            [clojure.core.typed :as t]
            [clojure.core.typed.async :as t.a]))

(t/ann my-chan [-> (t.a/Chan Number)])
(defn my-chan [] (t.a/chan> Number))

;; (t/check-ns):
;;
;; WARNING: Type Checker: Definition missing: clojure.core.async/chan
;; Hint: Use :no-check metadata with ann if this is an unchecked var
;; Checked 1 namespaces (approx. 18 lines) in 7241.543591 msecs
;; Type Error (controller/tmp.clj:18:18) Unannotated var clojure.core.async/chan
;; Hint: Add the annotation for clojure.core.async/chan via check-ns or cf
;; in: clojure.core.async/chan
;;
;;
;; Type Error (controller/tmp.clj:18:18) Cannot instantiate non-polymorphic type: Error
;; in: clojure.core.async/chan
;;
;;
;; ExceptionInfo Type Checker: Found 2 errors  
;; clojure.core/ex-info (core.clj:4403)


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:35 AM ]

Fixed sometime before 0.2.58





[CTYP-150] Fix constraint generation with intersections Created: 08/Jun/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


 Description   

Unit tests involving intersections often randomly fail. I think we need to carefully reconsider the constraint resolution algorithm cases for intersections, in particular we need to be more consistent about which combinations of intersection members we use in the final cset.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 08/Jun/14 3:01 PM ]

Relevant: https://github.com/clojure/core.typed/commit/fe91e01855ec387ed5d1e30f4fe079d70782ffa7

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:33 AM ]

Intersections are now ordered.





[CTYP-145] Offer separate zero-dependency artifact Created: 26/May/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Enhancement Priority: Major
Reporter: Chas Emerick Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None

Attachments: File CTYP-145-1.diff     File CTYP-145.diff    
Patch: Code

 Description   

The objective here is to be able to apply typed-clojure to libraries, without having their downstream dependents require the typed-clojure dependency as well. The libraries in question would then be able to fold in a separate TC dependency (which would bring in e.g. analyzer, ClojureScript, etc) for doing the actual type checking at test-time, in addition to their "regular" tests which would be run without the TC machinery. (Leiningen profiles would be ideal for setting up these different sorts of testing contexts.)

Tasks include:

1. Defining a "top-level" zero-dependency namespace(s) that provides all of the user-facing type-annotation macros (which must be no-ops when evaluated outside of a type-checking process).
2. Modifying the TC pom.xml and other project configuration so that two dependencies are produced; one without dependencies containing only the above-noted namespace(s), and another that depends upon the first and which also carries the necessary dependencies for actually performing type checking.

Namespaces to be included in no-dep jar:

src/main/clojure/clojure/core/typed.clj
src/main/clojure/clojure/core/typed/internal.clj
src/main/clojure/clojure/core/typed/current_impl.clj
src/main/clojure/clojure/core/typed/profiling.clj
src/main/clojure/clojure/core/typed/util_vars.clj
src/main/clojure/clojure/core/typed/profiling.clj
src/main/clojure/clojure/core/typed/errors.clj
src/main/clojure/clojure/core/typed/coerce_utils.clj
src/main/clojure/clojure/core/typed/ast_utils.clj
src/main/clojure/clojure/core/typed/type_contract.clj
src/main/clojure/clojure/core/typed/load_if_needed.clj
;; TODO: ClojureScript stuff


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 26/May/14 6:30 AM ]

Namespaces that should go in the zero-dep jar:

src/main/clojure/clojure/core/typed.clj
src/main/clojure/clojure/core/typed/internal.clj
src/main/clojure/clojure/core/typed/current_impl.clj
src/main/clojure/clojure/core/typed/profiling.clj
src/main/clojure/clojure/core/typed/util_vars.clj
src/main/clojure/clojure/core/typed/errors.clj
src/main/clojure/clojure/core/typed/coerce_utils.clj
src/main/clojure/clojure/core/typed/ast_utils.clj
Comment by Chas Emerick [ 26/May/14 7:25 AM ]

From ambrosebs in #typed-clojure: the name of the no-deps artifact will be core.typed.rt.

Comment by Ambrose Bonnaire-Sergeant [ 26/May/14 11:02 AM ]

Removed tools.analyzer dep https://github.com/clojure/core.typed/commit/b35131e503547d46e13ec9d50f7def84ebd8db04

Comment by Chas Emerick [ 28/May/14 8:59 AM ]

It looks like we need to produce four artifacts now: core.typed and core.typed.rt, in "regular" and "slim". Does this sound right?

Comment by Ambrose Bonnaire-Sergeant [ 28/May/14 9:14 AM ]

I guess so. I'm not sure we need core.typed.rt "regular", but it might be useful.

Comment by Chas Emerick [ 28/May/14 12:23 PM ]

For those looking on, the WIP patch is here:

https://github.com/cemerick/core.typed/commit/0cd50d09fa17b9c833066b4cf9db7457b8e7f959

A project that uses the new "rt" zero-dep artifact to enable annotations without requiring downstream dependents to depend upon core-typed is here:

https://github.com/cemerick/pprng/tree/WIP-typed-clojure

Official patch to be attached shortly.

Comment by Ambrose Bonnaire-Sergeant [ 28/May/14 1:55 PM ]

Added load_if_needed.clj (latest master).

Comment by Chas Emerick [ 29/May/14 6:15 AM ]

Patch attached. When additional namespaces should be added to the core.typed.rt artifact, just add them to the listing in module-rt/pom.xml.

core.typed installs locally just fine with this patch, but there's no easy way for me to test it in the Jenkins/build.clojure.org environment. Only one way to find out if it plays nice there.

Comment by Chas Emerick [ 29/May/14 10:56 AM ]

Attached an additional patch ({{CTYP-145-1.diff}}) that adds a minimal test to ensure that core.typed.rt can load. This will catch cases when that subset of typed-clojure expands, but e.g. the file list in module-rt/pom.xml hasn't been updated to match.

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:32 AM ]

org.clojure/core.typed.rt now lives!





[CTYP-157] Fails to properly load protocols as soon as a ns containing a protocol is required from another checked ns Created: 17/Jun/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Major
Reporter: Daniel Ziltener Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

Linux, Java 8.



 Description   

Minimal test case: https://gist.github.com/zilti/ac127170605600d008bb



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 5:30 AM ]

I believe this is fixed with lein-typed 0.3.5.

Please try it.





[CTYP-159] "swap!" doesn't work anymore due to missing type translation Created: 23/Jun/14  Updated: 20/Jul/14

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

Type: Defect Priority: Critical
Reporter: Daniel Ziltener Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Clojure 1.6.0, core.typed 0.2.52



 Description   

Minimal test case:

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(ns server.minimal
  (:refer-clojure :exclude [doseq let fn dotimes defprotocol loop for])
  (:require [clojure.core.typed :refer :all]))

(ann b (Atom1 (Vec String)))
(def b (atom []))

(swap! b (fn [in] in))

The error message is: "Type Error (server/minimal.clj:8:1) Internal Error (server/minimal.clj:8:1) First argument to TApp must be TFn, actual: clojure.lang.Fn



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 4:44 AM ]

Does this still appear in 0.2.58? It might have been fixed.

Note that the inference for swap! is a bit volatile; you may have to annotate the second argument's parameter types now.





[CTYP-161] "Cannot assoc args" with HMap intersections Created: 09/Jul/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Defect Priority: Blocker
Reporter: Timo Mihaljov Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None
Environment:

[org.clojure/core.typed "0.2.53"]



 Description   
=> (t/cf (assoc (t/ann-form {:foo 1, :bar 2}
                            (t/HMap :mandatory {:foo Number
                                                :bar Number}))
                :baz 3))
[(t/HMap :mandatory {:baz (t/Value 3), :foo java.lang.Number, :bar java.lang.Number}) {:then tt, :else ff}]

=> (t/cf (assoc (t/ann-form {:foo 1, :bar 2}
                            (t/I (t/HMap :mandatory {:foo Number})
                                 (t/HMap :mandatory {:bar Number})))
                :baz 3))
Type Error (/private/var/folders/x2/47j5hlbs01b9b4mjz_8fyf05m8hy4p/T/form-init2093510643541319345.clj:1:7) Cannot assoc args `[(clojure.core.typed/Value :baz) {:then tt, :else ff}] [(clojure.core.typed/Value 3) {:then tt, :else ff}]` on (clojure.core.typed/I (clojure.core.typed/HMap :mandatory {:foo java.lang.Number}) (clojure.core.typed/HMap :mandatory {:bar java.lang.Number}))
ExceptionInfo Type Checker: Found 1 error  clojure.core/ex-info (core.clj:4327)



 Comments   
Comment by Timo Mihaljov [ 09/Jul/14 6:15 AM ]

As a workaround, assoc can be replaced with assoc-in. It loses the type and returns Any, but the type can be recovered with an assertion or a postcondition (e.g. {:post [((t/pred MyMap) %)]}).

Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 4:42 AM ]

Fixed, will appear in 0.2.59

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





[CTYP-162] A few annotations were added for clojure.string namespace. Created: 18/Jul/14  Updated: 20/Jul/14

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

Type: Enhancement Priority: Trivial
Reporter: Aravind K N Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File string.diff    
Patch: Code and Test

 Description   

Typed annotations were added for blank?,capitalize,lower-case,replace,reverse and trim.



 Comments   
Comment by Andy Fingerhut [ 19/Jul/14 11:16 AM ]

Aravind, triml and trimr have the same type as trim, and should be easy to add.

clojure.string/replace has a more complex type than [String -> String]. Take a look at the documentation string to get a better idea of what it does. clojure.string/replace-first has the same type signature, so once you get one right you can copy it to the other.





[CTYP-163] Corrections to a few type signatures for clojure.core functions Created: 19/Jul/14  Updated: 20/Jul/14  Resolved: 20/Jul/14

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

Type: Enhancement Priority: Trivial
Reporter: Andy Fingerhut Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None

Attachments: File ctyp-163-v1.diff    
Patch: Code

 Description   

Was reading through the clojure.core type signatures, and noticed that read-line and printf were incorrect, and format was in there twice. Small patch to correct these things attached.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/14 3:59 AM ]

Thanks merged https://github.com/clojure/core.typed/commit/87c5812ddd1ec3f336a9e53c9df53f436ec48cc6

read-line also returns nil according to Javadoc, fixed that myself https://github.com/clojure/core.typed/commit/e2eacf39bd494b026cbaccad3e9531cdce4b3332





Generated at Wed Jul 23 14:40:19 CDT 2014 using JIRA 4.4#649-r158309.