- Breaking: Removed deprecated/replaced macros (since 0.2.45) to improve future loading times
- clojure.core.typed/dotimes> (use t/dotimes)
- clojure.core.typed/for> (use t/for)
- clojure.core.typed/doseq> (use t/doseq)
- clojure.core.typed/pfn> (use t/fn)
- clojure.core.typed/fn> (use t/fn)
- clojure.core.typed/defn> (use t/defn)
- clojure.core.typed/def> (use t/defn)
- clojure.core.typed/defprotocol> (use t/defprotocol)
- clojure.core.typed/loop> (use t/loop)
- clojure.core.typed/atom> (use t/atom)
- clojure.core.typed/ref> (use t/ref)
- clojure.core.typed/def-alias (use t/defalias)
- clojure.core.typed/ann-precord (use t/ann-record)
- clojure.core.typed/ann-pprotocol (use t/ann-protocol)
- Breaking: Lazily load core type aliases
- since var's like t/Int are lazily interned, they cannot reliably be
:refer
ed.
- support for
:refer
ing deftype
s and special types altogether may be
removed in a future release for a leaner runtime
- First step in removing interned vars backing
defalias
(inspired by clojure.spec)
- Removed tools.analyzer.env usage (
update-ns-map!
etc.)
- ~30% performance improvement in analysis
- Various cleanups
- Removed old
:profiling
support for check-ns
etc. - remove project.clj, migrate to Clojure CLI
- add annotations for some clojure.core Transducers (but usages are still too hard to infer for now)
- fix bad
clojure.core/take-while
annotation
- Split namespaces into maven submodules
- automatic annotation work in
module-infer
- with artifact id
org.clojure/core.typed.infer
- tools.analyzer fork in
module-analyzer-jvm
- with artifact id
org.clojure/core.typed.analyzer.jvm
- merge WIP custom typing rules
- refactor checking logic
- support propagation of
fn
argument types while still
inferring the body
- Add circleci workflow to generate annotations
- Fix auto annotation bug
- types now are generally smaller throughout the inference algorithm, instead of just
at the end.
- described here
Breaking changes:
check-ns
et. al no longer recursively checks file
dependencies. Use (check-ns *ns* :check-deps true)
to recursively check dependencies.
Features:
- support ns aliases in
ann
- remove support for deprecated
ann
:nocheck
syntax - CTYP-297: Allow defmulti without expected type
Internal:
- Use custom single pass variant of tools.analyzer (
clojure.core.typed.analyzer2.jvm
)
- add :spec-macros option to
spec-infer
- port CLJ-2110, CLJ-1793, CLJ-1714 Compiler.java changes
- spec generation improvements
- added options to
prepare-infer-ns
- Upgrade to Clojure 1.9.0-alpha20
- type/spec generation
- lots of small fixes
- extensive performance improvements in generation algorithm
- support namespaced `s/keys
- added configuration options to {runtime,spec}-infer
Deprecations
{runtime,spec}-infer
now take keyword arguments, single namespace argument
is deprecated
Features/fixes
- remove documentation promising
check-ns
resets all environments on each run. This actually
changed a long time ago. - update tools.analyzer.jvm to 0.7.0
- some changes needed to uses of
analyze+eval
- update core.async to 0.3.44
- fragile workaround needed since core.async depends on
clojure.lang.Compiler.LocalBinding
. Seems to work. - updated the typed
go
wrapper
- update Clojure to 1.9.0-alpha17
- add metadata type annotations to
for
, loop
- use
:clojure.core.typed/ann
keyword metadata to associate
types to loop bindings
- various improvements to runtime inference
- infer local type annotations with runtime inference
- add/fix annotations
sorted-map
frequencies
big{dec,int,integer}
now also accept stringssort
pretends a nil return isn't possible, ignore unlikely
edge case.seqable?
now tests for (Seqable Any)
- set/vectors now invokable
- better handle infinitely expanding map types
- Add new
{runtime,spec}-infer
keyword options
- Monkeypatched typed load now takes variable arguments like
clojure.core/load
- Added
prepare-infer-ns
function to instrument a namespace
for runtime type inference without using monkeypatching.
- merge Aravind's GSoC annotations
- added annotations for core clojure libraries
- merge Di Xu's GSoC 2014 code
- Add pdot/prest support
- update core type annotations
- move core.async dep from
core.typed.rt
to core.typed
pom
Release Notes - core.typed - Version 0.3.29
Defect
- [CTYP-318] - Ensure :static-method has :class entry
- [CTYP-319] - Single-pass compiler misses interfaces
- [CTYP-320] - Don't track internals of track implementation
Enhancement
- [CTYP-294] - Infer untyped vars via unsafe Dyn-like type
- improve line numbers in errors
- update Clojure to 1.9-alpha14
- update Compiler.java port
- instrument primitive functions for runtime inference (CTYP-316)
- remove core.contracts dependency
- include AOT files in org.clojure/core.typed jar
- Use modified
clojure.lang.Compiler
as analyzer
instead of tools.analyzer. - Remove CLJS dependency
- Add Clojure 1.9.0-alpha11 compatibility
- fix dependencies with spec errors
- update vector destructuring type checking
- uses seq/next instead of nthnext
- Add runtime inference generation
runtime-infer
generates core.typed typesspec-infer
generates clojure.spec specs
Release Notes - core.typed - Version 0.3.23
Defect
- [CTYP-313] - subtyping optional keywords in HMaps
Task
- [CTYP-308] - Enable sanity-checking compilation of core.typed-rt project
Prefer 0.3.22, which removes some debugging statements.
We now monkey-patch eval
via the
clojure.core.typed/install
function. See the docstring for how it works.
The new (Leiningen) bootstrapping code is now:
:injections [(require 'clojure.core.typed)
(clojure.core.typed/install)]
Enhancement
- [CTYP-307] - Override `eval` to type check code in typed namespaces
Defect
- [CTYP-283] - Directly-linking in Clojure 1.8.0 interferes with load monkey-patching
- [CTYP-285] - Cljc reader conditionals in ns form cause core.typed to skip checking namespace
- [CTYP-305] - t/cast does not run under rewriting type checking
Enhancement
Defect
- [CTYP-296] - Overlap of free variables and other types should not be empty
Enhancement
- [CTYP-295] - Update ns wrapper macro with Clojure 1.8 changes
- [CTYP-299] - Add per-namespace flag to check annotations at runtime
Enhancement
- [CTYP-288] - Type checker should understand clojure.core.typed/cast
Defect
- [CTYP-291] - ClassNotFoundException clojure.core.cache.CacheProtocol
Enhancement
- [CTYP-287] - Add contract system and `cast` expression
Release Notes - core.typed - Version 0.3.15
Defect
- [CTYP-283] - Directly-linking in Clojure 1.8.0 interferes with load monkey-patching
Task
- [CTYP-286] - Convert inlined dependencies back to regular jars
Misc
- Bump tools.reader, tools.analyzer.jvm versions
Release Notes - core.typed - Version 0.3.14
Enhancement
- [CTYP-246] - Gradually typed namespaces should import untyped vars with a contract
- [CTYP-281] - Separate `load` monkey-patch and typed REPL
Release Notes - core.typed - Version 0.3.12
Enhancement
- [CTYP-239] - Search for .cljc files when checking a namespace
Release Notes - core.typed - Version 0.3.11
Enhancement
- [CTYP-269] - Combine mutable environments into one atom
Release Notes - core.typed - Version 0.3.10
Use static types to resolve simple Java interoperability
In situations where it is appropriate to rewrite a function, like in the typed
REPL or when a function body is checked only once, we can use static types to
resolve Java interoperability.
For example, the following code is non-reflective.
(fn [a :- java.io.File]
(.getParent a))
The same rules apply as usual with occurrence typing. The static type of the target
and arguments at the site of the interop is used to avoid reflection.
(fn [a]
{:pre [(instance? java.io.File a)]}
(.getParent a))
For now, only very simple types that are easily converted to type hints are used
as type hints (like File
or String
).
Furthermore, only methods and constructors are rewritten, and only local bindings
can propagate type information.
Please report how effective this is in practice.
- [CTYP-250] - Resolve Java interoperability based on static type information
- [CTYP-259] - Rewrite function bodies if they are only checked once
- [CTYP-247] - Function bodies should rewrite themselves if possible
- [CTYP-264] - deftype should rewrite method bodies
- [CTYP-265] - Anonymous functions should rewrite body
Elide checking on output of ns form
This change shaved 2-3 minutes from running the test suite and should save 500ms on
each check-ns
call.
- [CTYP-266] - Elide checking of ns macro output for performance
Defect
- [CTYP-263] - Unnecessary type hint required in catch expression
Release Notes - core.typed - Version 0.3.9
This release mostly prepares for AST rewriting. Some bugs around
types and propositions are fixed.
Defect
- [CTYP-210] - (long AnyInteger) doesn't typecheck
- [CTYP-257] - Empty intersection should be Top, not Bottom
- [CTYP-258] - Correctly simplify negative type propositions in constructor
Enhancement
- [CTYP-172] - ExactCount should work with destructuring
Task
- [CTYP-251] - Remove dead code clojure.core.typed.check.fn-method
- [CTYP-252] - Suppress tools.analyzer's warn-on-reflection
- [CTYP-253] - Remove static/instance flag in check-method
- [CTYP-254] - Add flag to enable AST rewriting
- [CTYP-255] - Unparse should be flexible to unknown implementations
- [CTYP-256] - Add :unknown implementation to impl-case
JIRA Release notes
Release Notes - core.typed - Version 0.3.8
This release contains mainly bug fixes. The typed defn
now supports
a metadata map and :arglists
metadata (CTYP-168).
Thanks to Tobian Kortkamp for contributing a patch.
Defect
- [CTYP-27] - clojure.lang.RT/nth's type doesn't currently allow nil as the first argument
- [CTYP-80] - Issue with filter subtyping/simplification
- [CTYP-203] - Unreproducable internal error
- [CTYP-212] - Can't create a promise of the same type as a record field
- [CTYP-234] - Setting :collect-only attribute for a namespace does not collect type aliases
Enhancement
- [CTYP-113] - Better documentation for override-method
- [CTYP-168] - Support metadata map and :arglists in clojure.core.typed/defn
Task
- [CTYP-248] - Move lexical environment to an easily accessible location
org.clojure/core.typed
now has no external dependencies.
They are all copied with a flat prefix to clojure.core.typed.deps.*
.
The current versions of copied libraries are in project.clj
,
prefixed by ^:source-dep
.
core.typed
should work fine with 1.6 for a while, but I might start
using some Clojure 1.7 features and change the base-env to annotate
Clojure 1.7.0 core vars.
The standard org.clojure/core.typed
jar has AOT classes for core.typed
and its dependencies.
Beforehand, AOT files for old CLJS versions was causing havoc.
This is hopefully less of a problem now —
since all dependencies are in clojure.core.typed.deps.*
,
it's easy to create a filer to delete these extra files.
[org.clojure/core.typed "0.3.7" :classifier "slim"]
gives you just
the Clojure sources.
(ann M (U '{:op '"left" :left Int}
'{:op '"right" :right Bool}))
(ann M (U '{:op '"left" :left Int}
'{:op '"right" :right Bool}))
(ann f [M -> Any])
(defmulti f (fn [m :- M] (keyword (:op m))))
(defmethod f :left [{:keys [left]}] (inc left))
(defmethod f :right [{:keys [right]}] (not right))
- Fix:
def
expressions now check their expected types - Revert 0.3.0 change:
check-ns
now always eagerly checks transitive namespaces - Add various tracing and metrics for POPL submission
-
Breaking change: (REVERTED 0.3.1)
- all
check-ns
operations now avoid rechecking transitive dependencies.
To explicitly recheck dependencies use the :clean
keyword parameter.
-
Fix CTYP-214
-
support quoted type syntax with string literals
-
clojure.core/keyword
annotation is now more permissive.
-
add keyword
path element
- see
keyword-pe-test
for new idioms
- restore original ns in nREPL eval
- support .cljc files in
load
- warn if :no-check is being removed from a var
- annotate
- clojure.repl/print-doc
- complete.core annotations
- support :load-file nREPL packets
- improved typed REPL interactions
- fix
*e
annotation, can be nil - depend on clojure 1.7.0-RC1
clojure.core.typed/check-form-info
return map entry :delayed-errors
deprecated for :ex
.
- removed
*checking*
var - bump tools.reader to 0.9.2
- improve application error messages
- find most general function signature
Thanks to Allen Rohner who provided patches for this release.
- Fix CTYP-215
- Fix CTYP-174
- Fix CTYP-181
- better types for primitive casts
- Fix CTYP-170
- Fix CTYP-200
core.typed is now integrated into the compilation process for namespaces with
:core.typed
metadata mapped to a true value.
To enable the typed REPL, add this to your project.clj:
:repl-options {:nrepl-middleware [clojure.core.typed.repl/wrap-clj-repl]}
Then the typed REPL can be invoked by code such as this.
(ns ^:core.typed typed)
(inc 'a)
- Remove AOT files from jar again
- depend on clojure 1.7.0-alpha6
- bump math.combinatorics dep to 0.1.1
- document defalias is recursive
- erase 3rd party AOT files from
org.clojure/core.typed
jar
- fix
(fn [m :- (HMap :optional {:a (U Num)})] (if (:a m) (inc (:a m)) 0))
- better handling of non-nil default values for kw-lookup and get
- fix isa? and = not checking filters
- generalise ClassPE case in update
- fix +ve proposition for keyword-invoke
Thanks to Nathan Sorenson who contributed patches included in this release.
- Fix bad propositions in isa?
- Fix CTYP-198
- Fix a bunch of special type checked forms (eg. merge) not checking expected type
- defalias's that "overwrite" existing imported vars no longer silently fail
- defalias must take an unqualified symbol, and its expansion includes a
declare
BREAKING CHANGE
- defalias :forms metadata must be quoted to avoid evaluation
- Complete CTYP-186 - type check
restore-right
- includes useful tweaks to occurrence typing
- Fix CTYP-185 - base-env load ordering issues
- let aliasing tests
- Improve
clojure.core/flatten
type
- Fix CTYP-169
- update* is like Typed Racket's update
- obviously truthy local bindings now infer filters of {:then tt :else ff}
instead of {:then (! (U nil false) x) :else (is (U nil false) x)}
- Add let-aliasing
- Thanks to Andrew Kent for original design/implementation and help
- Let-aliasing fixes CTYP-108
- Tests for monitor-{enter,exit}
- Use new check-below style for checking expected type
Thanks to Kyle Kingsbury for contributing to this release.
clojure.core.typed/{fn,defn}
supports a polymorphic binder with :forall [x]
before all arguments
(defn :forall [x]
identity [a :- x]
(fn :forall [x] [a :- x] a)
- defmulti no longer propagates an expected type to dispatch function
- If your dispatch function relies on the input type of the multimethod,
it must be explicitly annotated
;old behaviour
(ann f [Num -> Num])
(defmulti f (fn [a] (inc a)))
;new behaviour
(ann f [Num -> Num])
(defmulti f (fn [a :- Num] (inc a)))
clojure.core.typed/fn
no longer infers a better type for the body if it is provided an expected type for the body
- ie.
(fn [a] :- Any 1)
is [Any -> Any]
, not [Any -> Num]
-
Major bug: propagate expected types to if
expressions correctly
-
Fix get
operations with keyword key and default value
-
parse annotations in base-env as needed
-
improved log message that explains why a namespace was skipped during type checking
-
annotate clojure.core/sequential?
-
better line number when checking map literal entries
-
allow non-heterogeneous types in map destructuring
- made PersistentHashMap/create more flexible, which is used in map destructuring
-
fix recur arguments not being checked correctly
-
fn> without expected return type now always returns Any
- fn> will be removed soon, use clojure.core.typed/fn
-
support :monitor-{enter,exit} AST nodes
-
fix isReduced inlining annotation
- add GetType fold case
- add various promote/demote cases
- Fix subtyping for higher-kinded type variables
- identical applications are trivially subtypes
- when operands vary, subtyping checks m's upper bound and does
subtyping check in the direction indicated by variance
- (m a) <: (m b), where a <: b and upper bound of m is (TFn [[x :variance :covariant]] Any)
- (m b) <: (m a), where b <: a and upper bound of m is (TFn [[x :variance :contravariant]] Any)
- Unions are checked properly
- (m a) <: (U (Reduced Int) (m a)
- restrictions:
- operators must be the same variable
- this can probably be improved slightly by doing a subtype
check between operators in the TApp-TApp subtyping case
instead of an = check
- Fix CTYP-175
- type checker does not load without cljs dependency
- affects 0.2.{69,70}
- Only load cljs.core once
- Give a better line number for variance errors
- Type check more internals
- Improve destructuring support for homogenous types
- Remove redundant type errors
- Better line numbers for type errors
- in theory, only bare non-IMeta literals lack line numbers like
(cf :a Int)
- Fix major memory leak
- removed interning, replaced with normal cached hashes
- Fixes CTYP-83
Thanks to Minori Yamashita (ympbyc) for his GSoC work this summer!
This release merges his progress.
Lots of cljs.core annotations.
[org.clojure/clojure "1.6.0"]
(minimum)[org.clojure/clojurescript "0.0-2268"]
- JDK 1.7 minimum
(0.2.64 is a dud)
Thanks to Aravind K N for this patch.
- annotations for clojure.string/{blank?,capitalize,lower-case,replace{,-first},reverse,trim{,rl}}
Thanks to Allen Rohner for this patch.
- CTYP-166 - more forgiving on ns dependencies without source files
- Support
(#{:a :b} x)
set membership idiom
- literal symbols, keywords, strings, numbers, booleans, characters and nil are supported
as set members
- also correctly handles the nil/false special cases
(let [foo :- (U false nil ':a ':b), :a]
(if (#{:a :b false nil} foo)
(ann-form foo (U ':a ':b false nil))
(ann-form foo (U false nil ':a ':b))))
- add rand-nth annotation
- core.typed.async
- <!!, <! and >! use ports. <! now takes 1 type variable
- add core.async example
- CTYP-81: bad annotation for alts{!,!!}
- Better formatting for c.c/apply error message
- add clojure.core.typed/envs for querying the current type checker state
- Bump math.combinatorics to 0.0.8
- CTYP-157: compilation issue fixed with lein-typed 0.3.5
- CTYP-161: support intersections of HMaps in assoc
- CTYP-163: fix some annotations (Thanks Andy Fingerhut)
- core.typed.async
- <!! now takes 1 type variable
- Fixed some annotations
- Add
clojure.core.typed/defn
- Deprecate
clojure.core.typed/defn>
- Fix docstrings for imported
clojure.core.typed
macros clojure.core.typed/def
uses ann-form
to propagate expected type
instead of ann
clojure.core.typed/{fn,defprotocol}
preserves metadata in parameter vector- imported clojure.core.typed macros preserve their docstrings
- Bump tools.namespace 0.2.5
-
0.2.55 is bad
-
Fix bug where push-thread-bindings is checked, even though
it's special
- this broke
binding
checks
-
Update contrib-annotations to new namespaced syntax
- Improve warning messages
- Add UPGRADING.md
- Fix defprotocol with docstring
- Upgrade to tools.analyzer 0.3.0
- almost all unnamespaced type syntax are now namespaced under
clojure.core.typed
- Deprecation messages will direct what has changed
- eg. HMap -> clojure.core.typed/HMap
- Fn is now clojure.core.typed/IFn
- some exceptions: Array syntax is the same
- Deprecated chan>/{,sliding-,dropping-}buffer>
- use chan/{,sliding-,dropping-}buffer
- Note new syntax in docstrings
- Type checking in go macro now actually works
- clojure.core.typed/go> is deprecated, use go
- Libraries should depend on
org.clojure/core.typed.rt
- minimum dependency runtime support
- Thanks to Chas Emerick
- Improvements to local file mapping
- vim-typedclojure now uses it for mouseovers
0.2.46 doesn't work with :file-mapping
Seq*
is deprecated, use HSeq
Vector*
is deprecated, use HVec
- Add
:file-mapping
option for check-{ns,form}-info
(-> (check-ns-info *ns* :file-mapping true)
:file-mapping)
;=> {{:line 1 :column 1 :file "current/file.clj"} "Int"
; {:line 2 :column 4 :file "current/file.clj"} "Any"
; ...}
- Add namespaced versions of special forms like HMap
- non-namespaced versions will be deprecated soon, but will still work
Thanks to Di Xu and Nicola Mometto who contributed patches.
This release deprecates most of the > suffixed annotation macros
and replaces them with nicer named versions. In some cases the
syntaxes are different (return type in for
goes after the binding vector),
so check the respective docstrings. The old versions are kept for backwards
compatibility.
Some big usability enhancements:
- vars are now inferred from their
def
s - macros like
ann-form
don't interfere with normal type hint inference - failed interop calls now display a list of possible annotations
- Annotation for
clojure.core/vector
now uses dotted variables
inst
ing the new type will give a different type- The first type variable is for the "rest" type that delegates to
Vec
, second onwards instantiate the HVec positions. - eg.
(map (inst vector Any Num Sym) [1 2 3] ['a 'b 'c])
- Changed
partial
annotation
- Changed
complement
annotation
- remove unused type variable
- Parameterise several Java interfaces
- java.util.{List,Collection,Set,RandomAccess}
- java.lang.{Iterable}
clojure.core.typed/{fn>, loop>, defprotocol>, dotimes>, doseq>, for>, def>}
- use more flexible forms without
>
suffix - note syntax changes in docstrings
clojure.core.typed/def-alias
- prefer
clojure.core.typed/defalias
- renamed for consistency with core Clojure
- CTYP-130 Add HSequential which abstracts over HSeq/HVec/HList/HSeq
- Contributed by Di Xu + Ambrose
- Recognise Java types that work with
nth
, like CharSequence
- achieved by pretending they extend
clojure.lang.Indexed
- Annotate
clojure.lang.PersistentHashMap
- Wrapping in forms like
tc-ignore
or ann-form
no longer interfere with normal type hint inference - Add
clojure.core.typed/{def, defn, let, fn, loop, dotimes, for, doseq, defprotocol}
- Add
clojure.core.typed/defalias
- Unannotated
def
forms now attempts to infer a type based on the initial expression instead
of failing with an "Unannotated var" type error
warn-on-unannotated-vars
disables this inference
- Add aliases
clojure.core.typed/{Sym,Kw}
- Use correct classloader to reflect on analyzed class
- Contributed by Nicola Mometto
- Fix a bunch of bogus cs-gen/subtype cases with hetereogeneous collection types
that have rest/drest
- Be more robust in handling reflection calls
- Fix type annotation for
nth
inlining
- collection argument must be Sequential or Indexed
- remove
tc-ignore-forms*
- special typed forms use a
do
expression tagged with :clojure.core.typed/special-form
instead of special functions
- Move to
tools.analyzer.jvm
0.1.0-beta13 - Move to ClojureScript 0.0-2202
0.2.42 did not bind file correctly and gives useless tmp files
with type errors.
0.2.43 attempted to clean up the AOT jar, 0.2.44 reverted that.
- move Clojure AST checking to
tools.analyzer.jvm
Thanks to Di Xu who contributed patches.
- Fix CTYP-126 Better support for checking
dotted functions
- Fix pred bug where types did not resolve in the current namespace
- Promise alias is now invokable
- Add type aliases
- Partial fix to CTYP-124
- we now propagate negative information related to a
case
expression's
target expression in the default branch. However the case
macro aliases
the target expression with a fresh local, so core.typed isn't smart enough
actually use this information. Need equality/aliasing filters.
- Various error message & documentation improvements
- Fix CTYP-127
- support keyword lookups on bounded type variables
- Base type aliases are now in
c.c.t/current-impl
- Add
Seq*
and List*
cases to runtime type parsing