<< Back to previous view

[CTYP-234] Setting :collect-only attribute for a namespace does not collect type aliases Created: 23/Jun/15  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

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

Tested with 0.3.0-alpha5


Attachments: Text File ctyp-234.patch    
Patch: Code and Test

 Description   

Problem

Adding the {:core.typed {:collect-only true}} attribute to a namespace prevents core.typed from collecting any type aliases defined via defalias in that namespace.

E.g.

(ns collect-only-bug.other
  {:core.typed {:collect-only true}}
  (:require [clojure.core.typed :as t]))

(t/defalias MyType (t/HMap :mandatory {:foo String
                                       :bar t/AnyInteger}))
(ns collect-only-bug.core
  (:require [clojure.core.typed :as t]
            [collect-only-bug.other :as other]))

(t/ann foo [other/MyType -> t/AnyInteger])
(defn foo
  [x]
  (:bar x))
user=> (t/check-ns 'collect-only-bug.core)
Start collecting collect-only-bug.core
Finished collecting collect-only-bug.core
Collected 1 namespaces in 218.520311 msecs
Not checking clojure.core.typed (does not depend on clojure.core.typed)
Not checking collect-only-bug.other (tagged :collect-only in ns metadata)
Start checking collect-only-bug.core
Type Error (collect_only_bug/core.clj:8:9) Internal Error (collect_only_bug/core.clj:8:3) Cannot resolve name collect-only-bug.other/MyType

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

Solution

Add a new predicate should-collect-ns? and use it in collect-phase
to pick namespaces to collect.

Pull request: 33
Patch: ctyp-234.patch (some trailing whitespace)
Commit: 773291
Release: 0.3.8



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 24/Jun/15 8:16 AM ]

Started work here: https://github.com/typedclojure/core.typed/pull/10





[CTYP-80] Issue with filter subtyping/simplification Created: 02/Oct/13  Updated: 20/Jul/15  Resolved: 20/Jul/15

Status: Resolved
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

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

Attachments: Text File ctyp-80-fix.patch    

 Description   

This code apparently broke around 0.2.11. It's unclear what the issue was,
but it seems it was fixed sometime before 0.3.7.

http://paste2.org/kWVNZxC7

Code review: CTYP-80
Patch: ctyp-80-fix.patch
Commit: e21ece3
Release: 0.3.8






[CTYP-212] Can't create a promise of the same type as a record field Created: 20/Apr/15  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

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

[org.clojure/core.typed "0.2.84"]
[org.clojure/clojure "1.6.0"]


Attachments: Text File ctyp-212.patch    
Patch: Code and Test

 Description   

Problem

It seems to be impossible to create a promise of the same type as a record field:

(ns cttest.core
  (:require [clojure.core.typed :as t]))

(t/ann-record MyRecord [p :- (t/Promise int)])

(defrecord MyRecord [p])

(defn foo []
  (t/let [x :- (t/Promise int) (promise)]))

; Type Error (cttest/core.clj:9:32) Polymorphic function promise could not be applied to arguments:
; Polymorphic Variables:
;         x
;
; Domains:
;
;
; Arguments:
;
;
; Ranges:
;         (t/Promise x)
;
; with expected type:
;         (t/Promise int)
;
; in: (promise)
; in: (promise)

Changing the type of p in MyRecord to any other type, say (t/Promise String) makes foo pass the type checker.

Solution

This seems to have been fixed sometime between 0.2.84 and 0.3.7. Adding a
passing unit test to close this issue.

Pull request: 30
Patch: ctyp-212.patch
Commit: 2c00a3f
Release: 0.3.8



 Comments   
Comment by Timo Mihaljov [ 20/Apr/15 11:36 PM ]

I hit the save button too soon. I couldn't reproduce this in a clean project, so there's something else going on in my project that's causing this. I might reopen the issue once I've narrowed down what's causing it.

Comment by Timo Mihaljov [ 22/Apr/15 12:39 AM ]

The difference was that the test project was missing the record. I've reopened the issue now that it's reproducible.





[CTYP-203] Unreproducable internal error Created: 09/Mar/15  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

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

osx yosemite, jdk 7


Attachments: Text File ctyp-203.patch    
Patch: Code and Test

 Description   

Problem

It is unclear how to reproduce, but this is the original report.

The following REPL shows the problem:

(t/defalias BaseValidationSchema
            '[java.lang.Boolean (t/HMap :complete? false)])

=> nil
(t/cf [true {}] BaseValidationSchema)
Type Error (NO_SOURCE_FILE) Internal Error (:<NO LINE>) Wrong number of arguments passed to type function. Expected 1, actual 2: clojure.core.typed/Vec [java.lang.Boolean (clojure.core.typed/HMap :mandatory {})]
ExceptionInfo Type Checker: Found 1 error  clojure.core/ex-info (core.clj:4403)
(t/cf [true {}] '[java.lang.Boolean (t/HMap :complete? false)])
=> [(t/HVec [true (t/HMap :complete? true)]) {:then tt, :else ff}]

From https://groups.google.com/d/msg/clojure-core-typed/uX2v9wbwTwI/yyErih2cPDMJ

Solution

Add passing unit test since we cannot reproduce.

Pull request: 34
Patch: ctyp-203.patch
Commit: 372108
Release: 0.3.8






[CTYP-54] Merge compatible types to make more accurate ones Created: 11/Sep/13  Updated: 22/Jul/15  Resolved: 22/Jul/15

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

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


 Description   

We need to figure out how to merge types like (I (Vec Any) (Seqable Number)). A general solution is probably needed: we want a way for new types to "plug in" to this behaviour.

This needs to be considered in Clojurescript too, where Vec and Seqable are implemented as protocols and do not have an inheritance relationship.

(From https://gist.github.com/pnf/e208b0d44860aedc9c9d)

;; There seems to be some difficulty in merging the two assertions here.
(t/ann testassert6 [(t/Vec Any) -> (t/Vec t/AnyInteger)])
(defn testassert6 [m]
(assert (vector? m)) ; this should be redundant
(assert (every? integer? m))
m)
;; Type Error (imdb.testassert:92) Local binding m expected type (t/Vec t/AnyInteger), but actual type (I (IPersistentVector Any) (t/Coll t/AnyInteger))
;; in: m
;; Type Error (imdb.testassert:92) Type mismatch:
;; Expected: (t/Vec t/AnyInteger)
;; Actual: (I (IPersistentVector Any) (t/Coll t/AnyInteger))
;; in: (do (if (clojure.core/vector? m) nil (throw (new java.lang.AssertionError #))) (if (clojure.core/every? clojure.core/integer? m) nil (throw (new java.lang.AssertionError #))) m)
;; Type Error (imdb.testassert:92:1) Type mismatch:
;; Expected: (Fn [(t/Vec Any) -> (t/Vec t/AnyInteger)])
;; Actual: (Fn [(t/Vec Any) -> (I (IPersistentVector Any) (t/Coll t/AnyInteger)) :filters {:then (& (is (IPersistentVector Any) 0) (! (U nil false) 0)), :else (is (U nil false) 0)} :object {:id 0}])
;; in: (def testassert6 (fn* ([m] (do # # m))))



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 22/Jul/15 2:17 AM ]

This hasn't been an issue in practice, declined.





[CTYP-263] Unnecessary type hint required in catch expression Created: 27/Jul/15  Updated: 02/Aug/15  Resolved: 02/Aug/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: 0.3.9
Fix Version/s: 0.3.10, 0.3.x

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


 Description   

Problem

Below is a case where core.typed requires a type hint that Clojure itself doesn't.
(Clojure 1.7, core.typed 0.3.9)

user=> *warn-on-reflection*
true

user=> (try :anything (catch Exception e (.getCause e)))
:anything

user=> (t/cf (try :anything (catch Exception e (.getCause e))))
Type Error (/tmp/form-init1733185424844917450.clj:1:41) Unresolved host interop: getCause

Target java.lang.Exception has no member getCause

Hint: use *warn-on-reflection* to identify reflective calls
in: (. e getCause)

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

Adding a hint satisfies core.typed, but is unnecessary for plain Clojure.

user=> (t/cf (try :anything (catch Exception e (.getCause ^Exception e))))
(t/U (t/Val :anything) nil Throwable)

This used to work without the hint. It first started failing here: (git bisect)

be52bc50cb9f5fd7947d744c5045315ecb0561f1 is the first bad commit
commit be52bc50cb9f5fd7947d744c5045315ecb0561f1
Author: Ambrose Bonnaire-Sergeant <...@gmail.com>
Date:   Wed Jul 1 14:14:13 2015 +0800

    Upgrade tools.analyzer.jvm from 0.4.0 to 0.6.7.

Notes

Discussion: https://groups.google.com/forum/#!topic/clojure-core-typed/EJIl01yQhPk

tools.analyzer issue: http://dev.clojure.org/jira/browse/TANAL-112
(already fixed in 0.6.8-SNAPSHOT, see thread)

Solution

Bump t.a.j dep to include 966fe1f and add test.

Pull request: 50
Commits:






[CTYP-247] Function bodies should rewrite themselves if possible Created: 19/Jul/15  Updated: 02/Aug/15  Resolved: 02/Aug/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.10, 0.3.x

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


 Description   

Problem

core.typed resolves some reflective Java interop manually if the
Clojure compiler cannot.

(fn [a :- java.io.File] (.getParent a))

However, in some cases, *warn-on-reflection* still says reflection exists.

This especially happens inside function bodies.

The cause is probably mishandled rewriting of composite AST nodes like :fn
or :do which then drops the rewriting on the floor.

Next steps

Minimal failing case.

Pull request: 49
Commits: Fix+test 488c927






[CTYP-93] Support refinement types Created: 08/Nov/13  Updated: 20/Jul/15  Resolved: 20/Jul/15

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

Type: Enhancement Priority: Minor
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Declined Votes: 1
Labels: None


 Description   

Typed Racket's refinement types are useful. We should implement something similar.



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 20/Jul/15 11:17 PM ]

This really went nowhere - the issues with purity around refinement types are pretty odd (basically two invocations of a refined predicate must evaluate to the same value, ie. be pure functions, because they have the same object) and probably not something we want.

Looking to the future, perhaps we want upcoming newtype in Typed Racket.

Futher discussion:





[CTYP-27] clojure.lang.RT/nth's type doesn't currently allow nil as the first argument Created: 23/Jul/13  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

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

Attachments: Text File ctyp-27.patch    
Patch: Code and Test

 Description   

Problem

The destructuring of (let [[x] [1 2 3]] x) is type checked differently to
(first [1 2 3]), the former being a type error.

Solution

Already fixed sometime around 0.1.18, but adding tests to prove this works.

Notes

Re: Why (first [1 2 3]) isn't equivalent to (let [[x & xs] [1 2 3]] x)
"
; This is because clojure.lang.RT/nth's type doesn't currently allow nil as
; the first argument. Should be fixed in master, but please submit a bug report to
; JIRA, it might not be completely correct.
; -Ambrose"

From
https://github.com/frenchy64/type-examples/blob/master/src/type_examples/core.clj

I'm not sure if this is fixed in master, but I couldn't build the current 0.1.18-SNAPSHOT (master) to check.

Pull request: CTYP-27
Patch: ctyp-27.patch
Commit: f4c699d
Release: 0.3.8



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 23/Jul/13 6:09 AM ]

Sorry, master is a bit broken at the moment. It may take a week to get it stable actually!

Comment by Ambrose Bonnaire-Sergeant [ 27/Jul/13 9:41 AM ]

This needs a special case for invoke-nth, to handle things like (nth (I (Seqable x) (CountRange 1)) 0).





[CTYP-168] Support metadata map and :arglists in clojure.core.typed/defn Created: 12/Aug/14  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

Type: Enhancement Priority: Minor
Reporter: Tobias Kortkamp Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 1
Labels: None

Attachments: Text File 0001-Add-arglists-metadata-to-vars-defined-using-defn.patch     Text File 0002-Add-arglists-metadata-to-vars-defined-using-defn.patch     Text File 0003-Add-arglists-and-attr-map-support-to-defn.patch     Text File ctyp-168.patch    
Patch: Code and Test

 Description   

Minimal example:

(clojure.core/defn f [])
(meta #'f)
;; => {:arglists ([]), ...}

(clojure.core.typed/defn g [])
(meta #'g)
;; => :arglists key missing completely

This is problematic, because g's arguments won't show up in its documentation via e.g. clojure.repl/doc
and I think lots of other tools assume that :arglists is there.

I've attached a patch that should fix this (and have also just signed Clojure's CA).

Pull request: 32
Patch: ctyp-168.patch (deleted a trailing whitespace)
Commit: 73d6be1
Release: 0.3.8



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 12/Aug/14 11:41 AM ]

Is your name on this list? http://clojure.org/contributing

Comment by Ambrose Bonnaire-Sergeant [ 12/Aug/14 11:41 AM ]

Oh I see you just signed it. Let me know when your name pops up and I'll merge this. Thanks!

Comment by Ambrose Bonnaire-Sergeant [ 12/Aug/14 11:43 AM ]

I get some errors in the unit tests. Can you run `mvn test` and fix them please?

Comment by Tobias Kortkamp [ 12/Aug/14 12:15 PM ]

Found the problem and attached a new patch.
The tests pass now..

Comment by Tobias Kortkamp [ 12/Aug/14 11:14 PM ]

I've attached an updated version of the patch that additionally adds attr-map support to defn. The tests still pass and it looks like my name appears on the contributors list now.

Comment by James Reeves [ 04/Jan/15 8:47 PM ]

This would be useful to fix, otherwise docs aren't generated properly when using clojure.core.typed/defn.





[CTYP-172] ExactCount should work with destructuring Created: 25/Aug/14  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-172.patch    
Patch: Code and Test

 Description   

Problem

ExactCount does not work with destructuring.

learning.core=> (cf (fn [[a b] :- (I (Vec Num) (ExactCount 2))] [(+ a b)]))
Type Error (/private/var/folders/34/98dbvkhn7v1clfvl5_y_fkc00001j3/T/form-init2527243481617671751.clj) Static method clojure.lang.Numbers/add could not be applied to arguments:


Domains:
	java.lang.Long java.lang.Long
	java.lang.Double java.lang.Double
	AnyInteger AnyInteger
	java.lang.Number java.lang.Number

Arguments:
	(U nil Number) (U nil Number)

Ranges:
	java.lang.Long
	java.lang.Double
	AnyInteger
	java.lang.Number

in: (clojure.lang.Numbers/add a b)
in: [(clojure.lang.Numbers/add a b)]



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

Solution

This was fixed sometime before 0.3.8. Adding passing test to close this issue.

Pull request: 35
Patch: ctyp-172.patch
Commit: fb17b8
Release: 0.3.9






[CTYP-210] (long AnyInteger) doesn't typecheck Created: 08/Apr/15  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Resolved
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

[org.clojure/core.typed "0.2.84"]
[org.clojure/clojure "1.6.0"]


Attachments: Text File ctyp-210.patch    

 Description   
reiska.core=> (t/cf (long (+ 2 (int 123))))
Type Error (/private/var/folders/x2/47j5hlbs01b9b4mjz_8fyf05m8hy4p/T/form-init7340610759194794514.clj:1:7) Static method clojure.lang.RT/longCast could not be applied to arguments:


Domains:
        long

Arguments:
        t/AnyInteger

Ranges:
        long

in: (clojure.lang.RT/longCast (clojure.lang.Numbers/add 2 (clojure.lang.RT/intCast 123)))
in: (clojure.lang.RT/longCast (clojure.lang.Numbers/add 2 (clojure.lang.RT/intCast 123)))


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

Pull request: 36
Patch: ctyp-210.patch
Commit: 68d20b
Release: 0.3.9



 Comments   
Comment by Timo Mihaljov [ 14/Apr/15 10:57 PM ]

Here's what I think is going on:

1. clojure.core/long is defined as an inlineable function, so its body gets inlined and core.typed never sees the function application (long x) (where long's type is [t/Any -> Long]). Instead, it sees the method application (clojure.lang.RT/longCast x) and has to infer the method's type from its Java type.

This hypothesis is supported by the following experiment. Commenting out the inline form in a copy of clojure.core/long makes it apply cleanly to t/AnyInteger values.

;;; Doesn't typecheck

(t/ann ^:no-check my-long [t/Any -> long])
(defn my-long
  {:inline (fn [x] `(. clojure.lang.RT (longCast ~x)))}
  [^Number x]
  (clojure.lang.RT/longCast x))

(def a (my-long (t/ann-form 123 t/AnyInteger)))
;;; Typechecks

(t/ann ^:no-check my-long2 [t/Any -> long])
(defn my-long2
  ; Commented out: {:inline (fn [x] `(. clojure.lang.RT (longCast ~x)))}
  [^Number x]
  (clojure.lang.RT/longCast x))

(def b (my-long2 (t/ann-form 123 t/AnyInteger)))

2. The clojure.lang.RT/longCast method is overloaded. It seems that instead of inferring a multi-arity type, core.typed seems to pick just one of the arities. In this case it picks the wrong arity: t/AnyInteger is a valid argument to longCast(Object x), but not the picked longCast(long x).





[CTYP-257] Empty intersection should be Top, not Bottom Created: 23/Jul/15  Updated: 23/Jul/15  Resolved: 23/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-257.patch    

 Description   

Problem

An empty intersection (I) is currently simplified to (U), but it
should be the same as Any.

Solution

Modify the intersection constructors to return Any on empty intersections.

Pull request: 45
Patch: ctyp-257.patch
Commit: 565ff8
Release: 0.3.9






[CTYP-255] Unparse should be flexible to unknown implementations Created: 22/Jul/15  Updated: 23/Jul/15  Resolved: 23/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-255.patch    

 Description   

Problem

Unparsing a type, often during unit testing via prn, requires the
type system implementation to be specified. This is too restrictive.

Solution

The unknown implementation should verbosely print types, and ignore
the current namespace.

Notes

Implementation extracted from this branch.

Waiting on: CTYP-256
Pull request: 43
Patch: ctyp-255.patch
Commit: 48c225
Release: 0.3.9






[CTYP-258] Correctly simplify negative type propositions in constructor Created: 23/Jul/15  Updated: 23/Jul/15  Resolved: 23/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-258.patch    

 Description   

Problem

The negative type proposition constructor incorrectly simplifies
(! Any ...) to tt instead of (! Nothing ..) to ff.

Solution

Implement and/or test these optimisations:

  • (is Any ..) = tt
  • (is Nothing ..) = ff
  • (! Any ..) = ff
  • (! Nothing ..) = ff

Pull request: 46
Patch: ctyp-258.patch
Commit: 00b8d5
Release: 0.3.9






[CTYP-266] Elide checking of ns macro output for performance Created: 02/Aug/15  Updated: 02/Aug/15  Resolved: 02/Aug/15

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

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


 Description   

Problem

Checking the output of the ns macro is very slow.

=> (dotimes [i 3]
     (binding [*ns* *ns*]
       (time (cf (ns foo)))))
"Elapsed time: 527.803116 msecs"
"Elapsed time: 415.179303 msecs"
"Elapsed time: 497.35092 msecs"
nil

tc-ignore'ing the body delivers significant performance enhancements.

;; after patch
=> (dotimes [i 3]
     (binding [*ns* *ns*]
       (time (cf (ns foo)))))
"Elapsed time: 75.241128 msecs"
"Elapsed time: 60.542611 msecs"
"Elapsed time: 57.938648 msecs"
nil

Solution

tc-ignore body of ns macro, with an explicit nil return.

Pull request: 57
Commits: 8ce019d






[CTYP-250] Resolve Java interoperability based on static type information Created: 21/Jul/15  Updated: 02/Aug/15  Resolved: 02/Aug/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.10, 0.3.x

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


 Description   

Problem

Static type information can inform the Clojure compiler of non-reflective
Java interop. With the typed REPL, we now have a means to communicate this
information.

Approach

tools.analyzer.jvm returns :host-interop nodes for unresolved interop.
We first generate type hints based on the static types of the target/argument/
expected type, then passed the type-hinted AST back into the analyzer.

If this doesn't resolve the interop, we throw a type error a usual. If it does,
we type check as usual.

Pull request:

Commit: db3a3






[CTYP-264] deftype should rewrite method bodies Created: 01/Aug/15  Updated: 02/Aug/15  Resolved: 02/Aug/15

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

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


 Description   

Commits:






[CTYP-265] Anonymous functions should rewrite body Created: 01/Aug/15  Updated: 02/Aug/15  Resolved: 02/Aug/15

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

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


 Description   

Commits:






[CTYP-248] Move lexical environment to an easily accessible location Created: 20/Jul/15  Updated: 20/Jul/15  Resolved: 20/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

Type: Task Priority: Trivial
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: refinement-types

Attachments: Text File move-lex-env.patch    

 Description   

Problem

To start work on refinement types, we probably want the lexical environment to be easily accessible, especially from type-rep.

Approach

Add a new dynamic variable in util-vars and change existing dereferences of *lexical-env* to a function somewhere.

Code review: CTYP-248
Patch: move-lex-env.patch
Commit: CTYP-248
To appear: 0.3.8






[CTYP-113] Better documentation for override-method Created: 04/Mar/14  Updated: 21/Jul/15  Resolved: 21/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.8, 0.3.x

Type: Enhancement Priority: Trivial
Reporter: Ambrose Bonnaire-Sergeant Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 2
Labels: documentation

Attachments: Text File 0001-Update-override-method-documentation.patch    

 Description   

I've recently had to use override-method and could not find any usage examples anywhere. The doc string wasn't much help either, but I finally figured out how to use it. I've added my notes to override-method's doc string (see attached patch) in the hope that they are useful.

Patch: 0001-Update-override-method-documentation.patch
Pull request: 31
Commit: f1ed66c
Release: 0.3.8



 Comments   
Comment by Tobias Kortkamp [ 15/Aug/14 1:32 PM ]

I've recently had to use override-method and could not find any usage examples anywhere. The doc string wasn't much help either, but I finally figured out how to use it. I've added my notes to override-method's doc string (see attached patch) in the hope that they are useful.





[CTYP-251] Remove dead code clojure.core.typed.check.fn-method Created: 22/Jul/15  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-251.patch    

 Description   

clojure.core.typed.check.fn-method is dead code, it should be removed.

Pull request: 38
Patch: ctyp-251.patch
Commit: 7ff05e
Release: 0.3.9






[CTYP-253] Remove static/instance flag in check-method Created: 22/Jul/15  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-253.patch    

 Description   

Problem

The function clojure.core.typed.check.method/check-function takes an extra
argument that can be easily inferred from other arguments.

Solution

Delete the inst? flag and decide whether we have a static/instance method based
on the expression argument.

Pull request: 40
Patch: ctyp-253.patch
Commit: 9a217f
Release: 0.3.9






[CTYP-252] Suppress tools.analyzer's warn-on-reflection Created: 22/Jul/15  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Resolved
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-252.patch    

 Description   

Problem

We use tools.analyzer to analyze code before we emit and send to the standard
Clojure compiler for evaluation. We are planning to rewrite reflective calls,
so we don't want a warning if the initial analysis is reflective, but the final
evaluation is non-reflective.

Solution

Remove the warn-on-reflection pass from tools.analyzer.

Pull request: 39
Patch: ctyp-252.patch
Commit: 7cbc7d
Release: 0.3.9






[CTYP-254] Add flag to enable AST rewriting Created: 22/Jul/15  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-254.patch    

 Description   

Problem

Since we have both an offline (check-ns) way to type check, and online
(typed REPL), it only makes sense to rewrite the AST in certain cases.

Solution

Add a dynamic variable *can-rewrite* which is true when AST rewriting
makes sense.

Pull request: 41
Patch: ctyp-254.patch
Commit: 9e7b73
Release: 0.3.9






[CTYP-256] Add :unknown implementation to impl-case Created: 22/Jul/15  Updated: 23/Jul/15  Resolved: 23/Jul/15

Status: Resolved
Project: core.typed
Component/s: Core type system
Affects Version/s: None
Fix Version/s: 0.3.9, 0.3.x

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

Attachments: Text File ctyp-256.patch    

 Description   

Problem

Sometimes we want a default case when no implementation is specified in
impl-case. Since it throws an exception when falling through, we need
an explicit :unknown implementation.

Solution

Add :unknown implementation by default.

Pull request: 44
Patch: ctyp-256.patch
Commit: 856abf
Release: 0.3.9






Generated at Sun Aug 02 15:31:47 CDT 2015 using JIRA 4.4#649-r158309.