<< Back to previous view

[CTYP-272] check-ns: Assert failed: (r/Type? t) Created: 25/Aug/15  Updated: 25/Aug/15

Status: Open
Project: core.typed
Component/s: Clojure Checker
Affects Version/s: 0.3.10, 0.3.11
Fix Version/s: 0.3.12

Type: Defect Priority: Major
Reporter: Connor Clark Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: bug
Environment:

Java 8, Clojure 1.7, OS X 10.10.3


Attachments: File bugoutput     File jim.clj     File project.clj    

 Description   

The presence of the function

(defn foo
[x y]
(pos? (rem x y)))

in a namespace causes an assert error when check-ns is called on it.

Attached is the full output of lein typed check, and the full code for a lein project that demonstrates the bug. This only occurs in 0.3.11 and 0.3.10.






[CTYP-267] bigdec, bigint and biginteger eats (U Number String) Created: 03/Aug/15  Updated: 03/Aug/15

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

Type: Defect Priority: Minor
Reporter: Linus Ericsson Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: bug, typehints


 Description   
(cf bigdec) => [Number -> BigDecimal]

However bigdec can also read strings, like

(bigdec "10.10024") => 10.10024M

bigint and biginteger can also read strings.

The default annotations

clojure.core/bigdec [Number -> BigDecimal]
clojure.core/bigint [Number -> clojure.lang.BigInt]
clojure.core/biginteger [Number -> java.math.BigInteger]

should therefore likely be extended to

[(U Number String) -> ...]





[CTYP-242] adding stop-gap annotation for 'hash-map' results in runtime exception Created: 30/Jun/15  Updated: 30/Jun/15

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

Type: Defect Priority: Minor
Reporter: Jonathan Leonard Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 0
Labels: bug
Environment:

Mac OS X 10.10.3

$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

$ lein --version
Leiningen 2.5.1 on Java 1.8.0_45 Java HotSpot(TM) 64-Bit Server VM



 Description   

Adding the following annotation results in a runtime exception:

(t/ann ^:no-check clojure.core/hash-map
     [t/Any * -> (t/Map t/Any t/Any)])

Exception:

$ lein typed check 
Retrieving org/clojure/core.typed/0.3.3/core.typed-0.3.3.pom from central
Retrieving org/clojure/core.typed-pom/0.3.3/core.typed-pom-0.3.3.pom from central
Retrieving org/clojure/core.typed.rt/0.3.3/core.typed.rt-0.3.3.pom from central
Retrieving org/clojure/clojure/1.7.0-RC2/clojure-1.7.0-RC2.pom from central
Retrieving org/clojure/core.typed.rt/0.3.3/core.typed.rt-0.3.3.jar from central
Retrieving org/clojure/core.typed/0.3.3/core.typed-0.3.3.jar from central
Initializing core.typed ...
Building core.typed base environments ...
Exception in thread "main" java.lang.AssertionError: Assert failed: (every? r/Bounds? bbnds), compiling:(/private/var/folders/fg/8xpsfgln1_s0cwh3f1ksxtjr0000gq/T/form-init6446670678682645381.clj:1:124)
	at clojure.lang.Compiler.load(Compiler.java:7142)
	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)
Caused by: java.lang.AssertionError: Assert failed: (every? r/Bounds? bbnds)
	at clojure.core.typed.type_ctors$TypeFn_STAR_.invoke(type_ctors.clj:1040)
	at clojure.core.typed.type_ctors$TypeFn_STAR_.invoke(type_ctors.clj:1041)
	at clojure.core.typed.base_env_helper$declared_kind_for_rclass.invoke(base_env_helper.clj:179)
	at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env$fn__20119$fn__20125$iter__20126__20130$fn__20131.invoke(base_env_clj_rclass.clj:27)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:484)
	at clojure.core$seq.invoke(core.clj:133)
	at clojure.core$dorun.invoke(core.clj:2855)
	at clojure.core$doall.invoke(core.clj:2871)
	at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env$fn__20119$fn__20125.invoke(base_env_clj_rclass.clj:27)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env$fn__20119.invoke(base_env_clj_rclass.clj:27)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.core.typed.base_env_clj_rclass$generator_init_altered_env.invoke(base_env_clj_rclass.clj:25)
	at clojure.core.typed.base_env_clj_rclass$init_altered_env.invoke(base_env_clj_rclass.clj:25)
	at clojure.core.typed.base_env_clj_rclass$reset_rclass_env_BANG_.invoke(base_env_clj_rclass.clj:476)
	at clojure.core.typed.base_env$generator_init_alias_env$fn__20466.invoke(base_env.clj:64)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.core.typed.base_env$generator_init_alias_env.invoke(base_env.clj:64)
	at clojure.core.typed.base_env$init_alias_env.invoke(base_env.clj:64)
	at clojure.core.typed.base_env$reset_alias_env_BANG_.invoke(base_env.clj:67)
	at clojure.core.typed.base_env$reset_clojure_envs_BANG_$fn__20869$fn__20870.invoke(base_env.clj:1871)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.core.typed.base_env$reset_clojure_envs_BANG_$fn__20869.invoke(base_env.clj:1870)
	at clojure.core.typed.base_env$reset_clojure_envs_BANG_.invoke(base_env.clj:1870)
	at clojure.core.typed.reset_env$reset_envs_BANG_.invoke(reset_env.clj:20)
	at clojure.core.typed.init$load_impl$fn__1728$fn__1729.invoke(init.clj:113)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.core.typed.init$load_impl$fn__1728.invoke(init.clj:112)
	at clojure.core.typed.init$load_impl.invoke(init.clj:112)
	at clojure.core.typed.load_if_needed$load_if_needed.invoke(load_if_needed.clj:22)
	at clojure.core.typed$fn__919.invoke(typed.clj:54)
	at clojure.core.typed$fn__1678.doInvoke(typed.clj:2256)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at user$eval1698$fn__1699.invoke(form-init6446670678682645381.clj:1)
	at user$eval1698.invoke(form-init6446670678682645381.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6693)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	... 11 more
Subprocess failed


 Comments   
Comment by Jonathan Leonard [ 30/Jun/15 2:31 PM ]

The above exception call stack is for version: 0.3.3.

Version 0.3.0-alpha5 produces a different exception call stack:

Exception in thread "main" java.lang.AssertionError: Assert failed: (let [[derived-props derived-atoms] %] (and (every? (some-fn fl/ImpFilter? fl/OrFilter? fl/AndFilter?) derived-props) (every? (some-fn fl/TypeFilter? fl/NotTypeFilter?) derived-atoms))), compiling:(/private/var/folders/fg/8xpsfgln1_s0cwh3f1ksxtjr0000gq/T/form-init3689436395269879959.clj:1:124)
	at clojure.lang.Compiler.load(Compiler.java:7142)
	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)
Caused by: java.lang.AssertionError: Assert failed: (let [[derived-props derived-atoms] %] (and (every? (some-fn fl/ImpFilter? fl/OrFilter? fl/AndFilter?) derived-props) (every? (some-fn fl/TypeFilter? fl/NotTypeFilter?) derived-atoms)))
	at clojure.core.typed.update$combine_props.invoke(update.clj:58)
	at clojure.core.typed.check.let$check_let$fn__13761$fn__13769.invoke(let.clj:83)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core$update_in.doInvoke(core.clj:5698)
	at clojure.lang.RestFn.invoke(RestFn.java:445)
	at clojure.lang.AFn.applyToHelper(AFn.java:160)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core.contracts.constraints$apply_contract$fn__413.doInvoke(constraints.clj:174)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
	at clojure.lang.RestFn.invoke(RestFn.java:436)
	at clojure.core.typed.check.let$check_let$fn__13761.invoke(let.clj:79)
	at clojure.core.protocols$fn__6086.invoke(protocols.clj:143)
	at clojure.core.protocols$fn__6057$G__6052__6066.invoke(protocols.clj:19)
	at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
	at clojure.core.protocols$fn__6078.invoke(protocols.clj:54)
	at clojure.core.protocols$fn__6031$G__6026__6044.invoke(protocols.clj:13)
	at clojure.core$reduce.invoke(core.clj:6289)
	at clojure.core.typed.check.let$check_let.doInvoke(let.clj:103)
	at clojure.lang.RestFn.invoke(RestFn.java:445)
	at clojure.core.typed.check$check _COLON_let14930.doInvoke(check.clj:1629)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at clojure.lang.MultiFn.invoke(MultiFn.java:231)
	at clojure.core.typed.check.do$check_do$fn__12802$fn__12805.invoke(do.clj:41)
	at clojure.core.typed.check.do$check_do$fn__12802.invoke(do.clj:33)
	at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58)
	at clojure.core.protocols$fn__6093.invoke(protocols.clj:98)
	at clojure.core.protocols$fn__6057$G__6052__6066.invoke(protocols.clj:19)
	at clojure.core.protocols$seq_reduce.invoke(protocols.clj:31)
	at clojure.core.protocols$fn__6078.invoke(protocols.clj:54)
	at clojure.core.protocols$fn__6031$G__6026__6044.invoke(protocols.clj:13)
	at clojure.core$reduce.invoke(core.clj:6289)
	at clojure.core.typed.check.do$check_do.invoke(do.clj:61)
	at clojure.core.typed.check$check _COLON_do14821.doInvoke(check.clj:1382)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at clojure.lang.MultiFn.invoke(MultiFn.java:231)
	at clojure.core.typed.check.fn_method_one$check_fn_method1$fn__13601.invoke(fn_method_one.clj:183)
	at clojure.core.typed.check.fn_method_one$check_fn_method1.doInvoke(fn_method_one.clj:173)
	at clojure.lang.RestFn.invoke(RestFn.java:464)
	at clojure.core.typed.check.special.fn$check_anon$fn__13996.invoke(fn.clj:44)
	at clojure.lang.AFn.applyToHelper(AFn.java:178)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$map$fn__4260.invoke(core.clj:2578)
	at clojure.core$map$fn__4245.invoke(core.clj:2559)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:484)
	at clojure.core$seq.invoke(core.clj:133)
	at clojure.core.protocols$seq_reduce.invoke(protocols.clj:30)
	at clojure.core.protocols$fn__6078.invoke(protocols.clj:54)
	at clojure.core.protocols$fn__6031$G__6026__6044.invoke(protocols.clj:13)
	at clojure.core$reduce.invoke(core.clj:6289)
	at clojure.core$into.invoke(core.clj:6341)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core.contracts.constraints$apply_contract$fn__413.doInvoke(constraints.clj:175)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
	at clojure.lang.RestFn.invoke(RestFn.java:421)
	at clojure.core$mapv.doInvoke(core.clj:6360)
	at clojure.lang.RestFn.invoke(RestFn.java:580)
	at clojure.core.typed.check.special.fn$check_anon.invoke(fn.clj:31)
	at clojure.core.typed.check.special.fn$check_special_fn$fn__14110.invoke(fn.clj:206)
	at clojure.core.typed.check.special.fn$check_special_fn.invoke(fn.clj:199)
	at clojure.core.typed.check$fn__14797.invoke(check.clj:1364)
	at clojure.lang.MultiFn.invoke(MultiFn.java:231)
	at clojure.core.typed.check.do$check_do.invoke(do.clj:21)
	at clojure.core.typed.check$check _COLON_do14821.doInvoke(check.clj:1382)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.lang.MultiFn.invoke(MultiFn.java:227)
	at clojure.core.typed.check.def$check_normal_def.doInvoke(def.clj:61)
	at clojure.lang.RestFn.invoke(RestFn.java:442)
	at clojure.core.typed.check$check _COLON_def14956.doInvoke(check.clj:1673)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at clojure.lang.MultiFn.invoke(MultiFn.java:231)
	at clojure.core.typed.check$check_expr.doInvoke(check.clj:150)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.core.typed.check$check_asts$iter__14184__14188$fn__14189$fn__14190.invoke(check.clj:119)
	at clojure.core.typed.check$check_asts$iter__14184__14188$fn__14189.invoke(check.clj:118)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:484)
	at clojure.core$seq.invoke(core.clj:133)
	at clojure.core$dorun.invoke(core.clj:2855)
	at clojure.core$doall.invoke(core.clj:2871)
	at clojure.core.typed.check$check_asts.invoke(check.clj:118)
	at clojure.core.typed.check.utils$check_ns_and_deps_STAR_.invoke(utils.clj:479)
	at clojure.core.typed.check$check_ns_and_deps.invoke(check.clj:130)
	at clojure.core.typed.check_ns_common$check_ns_info$fn__17011$fn__17012.invoke(check_ns_common.clj:82)
	at clojure.core.typed.check_ns_common$check_ns_info$fn__17011.invoke(check_ns_common.clj:58)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invoke(core.clj:624)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.core.typed.check_ns_common$check_ns_info.doInvoke(check_ns_common.clj:44)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invoke(core.clj:628)
	at clojure.core.typed.check_ns_common$check_ns.doInvoke(check_ns_common.clj:112)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invoke(core.clj:628)
	at clojure.core.typed.check_ns_clj$check_ns.doInvoke(check_ns_clj.clj:23)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at clojure.core$apply.invoke(core.clj:626)
	at clojure.core.typed$fn__2034.doInvoke(typed.clj:2257)
	at clojure.lang.RestFn.invoke(RestFn.java:410)
	at user$eval7$fn__8.invoke(form-init3689436395269879959.clj:1)
	at user$eval7.invoke(form-init3689436395269879959.clj:1)
	at clojure.lang.Compiler.eval(Compiler.java:6703)
	at clojure.lang.Compiler.eval(Compiler.java:6693)
	at clojure.lang.Compiler.load(Compiler.java:7130)
	... 11 more
Subprocess failed




[CTYP-199] incorrect typing for group-by Created: 24/Feb/15  Updated: 03/Mar/15  Resolved: 03/Mar/15

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

Type: Defect Priority: Major
Reporter: Martin Raison Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: bug
Environment:

Using 0.2.80


Attachments: Text File CTYP-199.patch    

 Description   

It seems that group-by is incorrectly annotated. For example:

(cf (group-by even? [1 2 2]))

will return

(Map Boolean (U (Val 1) (Val 2)))

However the group-by operation returns

{false [1], true [2 2]}

so I think the type should be:

(Map Boolean (Vec (U (Val 1) (Val 2))))



 Comments   
Comment by Reno Reckling [ 27/Feb/15 8:22 PM ]

Patch to solve this.
Sorry, did not see the upload button on my first comment...

Comment by Ambrose Bonnaire-Sergeant [ 03/Mar/15 10:34 AM ]

Reno, I think you need to set an email for your local git.

Fixed https://github.com/clojure/core.typed/commit/78f4b5d58d712d9b67738a807aadcec641638078





[CTYP-198] incorrect optional keyword lookup in complete HMaps Created: 12/Feb/15  Updated: 22/Jul/15  Resolved: 22/Jul/15

Status: Closed
Project: core.typed
Component/s: Core type system
Affects Version/s: 0.2
Fix Version/s: 0.2

Type: Defect Priority: Major
Reporter: Nathan Sorenson Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: bug, patch
Environment:

Clojure 1.6.0 on OSX 10.10


Attachments: Text File 0001-tests-for-keyword-lookup-in-HMaps-with-optional-keys.patch     Text File 0002-fix-incorrect-optional-keyword-lookup-in-complete-HM.patch    
Patch: Code and Test

 Description   

Problem

The snippet

(t/cf (:name (t/ann-form {:name "hi"} (t/HMap :optional {:name String} :complete? true))))

returns nil when it probably should return (t/U String nil)

Commit:
1. e27143
2. f3713b
Release: 0.2.79






[CTYP-197] No matching arities when defining multiple arity protocol method Created: 25/Jan/15  Updated: 08/May/15

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

Type: Defect Priority: Major
Reporter: Joshua Griffith Assignee: Ambrose Bonnaire-Sergeant
Resolution: Unresolved Votes: 1
Labels: bug, defprotocol, deftype
Environment:

Clojure 1.6.0 and 1.7.0-alpha5


Attachments: File arity.clj     Text File typecheck.log    

 Description   

When defining multiple-arity protocol methods with clojure.core.typed/defprotocol, deftypes implementing these methods fail to typecheck with "No matching arities" errors. See attached test case.



 Comments   
Comment by Johan Gall [ 08/May/15 1:18 AM ]

i found a quite similar problem with defrecord. Is there some kind of workaround?

project.clj http://pastebin.com/bn6giuvH
core_typed_bug/core.clj http://pastebin.com/JjfhWLSH
error message http://pastebin.com/djsAicd1

with clojure 1.7.0-beta2 and core.typed 0.2.87

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

(t/defprotocol P
(f
[a] :- Any
[a b :- Any] :- Any))

(t/ann-record R [])
(defrecord R []
P
(f [a] 1)
(f [a b] 2))

will give the following arity related errors:

Collected 1 namespaces in 758.831468 msecs
Not checking clojure.core.typed (does not depend on clojure.core.typed)
Start checking core-typed-bug.core
10: Not checking core-typed-bug.core/->R definition
Checked core-typed-bug.core in 923.152062 msecs
Checked 2 namespaces in 1702.704416 msecs
Type Error (core_typed_bug/core.clj:10:1) No matching arities: [R t/Any -> t/Any]
in: (f [a] 1)

Type Error (core_typed_bug/core.clj:10:1) No matching arities: [R -> t/Any] in: (f [a b] 2)

Type Checker: Found 2 errors
Found errors





[CTYP-188] ann-record fails for argument-less records Created: 05/Jan/15  Updated: 27/Feb/15

Status: Open
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: Unresolved Votes: 0
Labels: bug
Environment:

Clojure 1.7.0-alpha4, core.typed 0.2.76



 Description   

ann-record fails for records without arguments. The whole error is as follows:

1. Unhandled java.lang.AssertionError
   Assert failed: (every? r/Type? types)

                type_ctors.clj:  497  clojure.core.typed.type-ctors/In
                   RestFn.java:  137  clojure.lang.RestFn/applyTo
                      core.clj:  626  clojure.core/apply
               assoc_utils.clj:   34  clojure.core.typed.assoc-utils/fn
               assoc_utils.clj:   23  clojure.core.typed.assoc-utils/fn/G
                type_ctors.clj: 2181  clojure.core.typed.type-ctors/reduce-type-transform/fn/iter/fn
                  LazySeq.java:   40  clojure.lang.LazySeq/sval
                  LazySeq.java:   49  clojure.lang.LazySeq/seq
                       RT.java:  485  clojure.lang.RT/seq
                      core.clj:  135  clojure.core/seq
                      core.clj: 2539  clojure.core/every?
                type_ctors.clj: 2179  clojure.core.typed.type-ctors/reduce-type-transform/fn
                 protocols.clj:  148  clojure.core.protocols/fn
                 protocols.clj:   19  clojure.core.protocols/fn/G
                 protocols.clj:   31  clojure.core.protocols/seq-reduce
                 protocols.clj:   53  clojure.core.protocols/fn
                 protocols.clj:   13  clojure.core.protocols/fn/G
                      core.clj: 6461  clojure.core/reduce
                type_ctors.clj: 2184  clojure.core.typed.type-ctors/reduce-type-transform
                   RestFn.java:  494  clojure.lang.RestFn/invoke
               assoc_utils.clj:  127  clojure.core.typed.assoc-utils/assoc-type-pairs
                   RestFn.java:  139  clojure.lang.RestFn/applyTo
                      core.clj:  628  clojure.core/apply
               assoc_utils.clj:  367  clojure.core.typed.assoc-utils/merge-pair/iter/fn/fn
               assoc_utils.clj:  342  clojure.core.typed.assoc-utils/merge-pair/iter/fn
                  LazySeq.java:   40  clojure.lang.LazySeq/sval
                  LazySeq.java:   49  clojure.lang.LazySeq/seq
                       RT.java:  485  clojure.lang.RT/seq
                      core.clj:  135  clojure.core/seq
                      core.clj: 2559  clojure.core/some
                type_ctors.clj: 2161  clojure.core.typed.type-ctors/union-or-nil
               assoc_utils.clj:  342  clojure.core.typed.assoc-utils/merge-pair
                type_ctors.clj: 2181  clojure.core.typed.type-ctors/reduce-type-transform/fn/iter/fn
                  LazySeq.java:   40  clojure.lang.LazySeq/sval
                  LazySeq.java:   49  clojure.lang.LazySeq/seq
                       RT.java:  485  clojure.lang.RT/seq
                      core.clj:  135  clojure.core/seq
                      core.clj: 2559  clojure.core/some
                type_ctors.clj: 2161  clojure.core.typed.type-ctors/union-or-nil
                type_ctors.clj: 2184  clojure.core.typed.type-ctors/reduce-type-transform
                   RestFn.java:  445  clojure.lang.RestFn/invoke
               assoc_utils.clj:  375  clojure.core.typed.assoc-utils/merge-types
                   RestFn.java:  139  clojure.lang.RestFn/applyTo
                      core.clj:  628  clojure.core/apply
                     check.clj: 1072  clojure.core.typed.check/merge)17420
                   RestFn.java:  423  clojure.lang.RestFn/invoke
                  MultiFn.java:  233  clojure.lang.MultiFn/invoke
                     check.clj: 1245  clojure.core.typed.check/check :invoke17476/fn
                     check.clj: 1243  clojure.core.typed.check/check :invoke17476


 Comments   
Comment by Daniel Ziltener [ 05/Jan/15 10:59 PM ]

Ok, mistake, this actually happens in certain assoc situations.

Comment by Reno Reckling [ 27/Feb/15 8:25 PM ]

Could you please post a minimum working example or some code to trigger this bug?





[CTYP-175] Initializing core.typed ... fails with IllegalArgumentException in CounterClockwise REPL Created: 02/Oct/14  Updated: 02/Oct/14  Resolved: 02/Oct/14

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

Type: Defect Priority: Major
Reporter: Rene Semmelrath Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: bug
Environment:

core.typed 0.2.70
Eclipse with ccw 0.2.68



 Description   

when I write (cf 1) in the REPL

Initializing core.typed ... fails
and writes:

IllegalArgumentException No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:544)

and of course does not work afterwards.

core.typed version 0.2.68 works just fine !!



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 02/Oct/14 9:13 PM ]

Fixed in 0.2.71 https://github.com/clojure/core.typed/commit/ac9562ed849be9441759ad02fffb356f5eef2450





[CTYP-132] typechecker fails when checking a Protocol whose method gets called using dot notation Created: 12/Apr/14  Updated: 18/Jun/14  Resolved: 13/Apr/14

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

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

Clojure 1.6.0, core.typed 0.2.44



 Description   

The error message is

No method in multimethod 'check' for dispatch value: :host-interop

The following is a minimal test case which fails:

core.clj
(ns core-typed-bug.core
    (:require [clojure.core.typed :refer :all]))
 
(defprotocol> ITypedTest
    (get-data [this]))
 
(defn> testfn :- Any
    [asdf :- Keyword, in :- ITypedTest]
    (.get-data in))

It works, however, when calling (get-data in) instead of (.get-data in).



 Comments   
Comment by Nicola Mometto [ 12/Apr/14 7:13 PM ]

tools.analyzer.jvm returns a :host-interop node when, like in this case, it encounters an interop form of the form (.foo bar) and can't determine whether it's a no-arg method call or a field-access.

I don't know enough about core.typed internals but it looks like there should be an add-check-method for :host-interop that behaves like check methods for :instance-field/:instance-call that resolve to runtime reflection (not :validated)

Comment by Ambrose Bonnaire-Sergeant [ 13/Apr/14 12:44 AM ]

Thanks Daniel & Nicola, fixed https://github.com/clojure/core.typed/commit/fa22d52d8e9855ebbaf2593ec5e848ba714b25fc

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

As of version 0.2.51, this still happens reliably.





[CTYP-122] annotation fails on recur Created: 16/Mar/14  Updated: 23/Mar/14  Resolved: 16/Mar/14

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

Type: Defect Priority: Minor
Reporter: Christian S Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: bug
Environment:

Mac OS X, clojure 1.5.1, Oracle JDK 1.7.0_45



 Description   

The following test case fails on check-ns. The issue seems to be the use of recur. The test case is modelled after clojure.core/<

huhu.clj
(ns huhu (:require [clojure.core.typed :refer :all]))
  (ann testcase [Number Number * -> boolean])
  (defn testcase
    ([x] true)
    ([x y] false)
    ([x y & more]
     (if (testcase x y)
       (if (next more)
         (recur y (first more) (next more))
         (testcase y (first more)))
       false)))

This is the result of check-ns:

(check-ns)
Start collecting huhu
Finished collecting huhu
Collected 1 namespaces in 26.58 msecs
Start checking huhu
AssertionError Assert failed: (AnyType? t)  clojure.core.typed.type-rep/ret (type_rep.clj:825)

If a recursive call instead of recur would be used it works. This is not a workaround to be applicable in every case.



 Comments   
Comment by Christian S [ 16/Mar/14 8:01 AM ]

clojure.core.typed version is [org.clojure/core.typed "0.2.37"]

Comment by Ambrose Bonnaire-Sergeant [ 16/Mar/14 8:38 AM ]

Fixed in 0.2.38-20140316.133526-3





[CTYP-67] core.typed doesn't interact well with inlining Created: 21/Sep/13  Updated: 25/Sep/13  Resolved: 25/Sep/13

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

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


 Description   

(cf compare)

gives

(Fn [Comparable Any -> Number])

but

(cf (fn [v x] (compare v x)) (Fn [Comparable Any -> Number]))

fails the type check.

(Credit: cspent on IRC figured out that the problem was that it was inlining the compare function, and therefore not using the annotation.)



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

Fixed https://github.com/clojure/core.typed/commit/044434b33c4d9ce1df95170bfff3c45a9c2cdbb6





[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-38] Core.typed doesn't understand inner class syntax inside non-nil-return Created: 30/Aug/13  Updated: 25/Sep/13  Resolved: 09/Sep/13

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

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


 Description   

Following code snippet illustrates that non-nil-return call has no effect on recipient-type-to function.
Core.typed still assumes that Message$RecipientType/TO can return nil.

(non-nil-return javax.mail.Message$RecipientType/TO :all)

(ann recipient-type-to [-> Message$RecipientType])
(defn ^Message$RecipientType recipient-type-to []
  (Message$RecipientType/TO))

(comment
  Type mismatch:
  Expected:       (Fn [-> Message$RecipientType])
  Actual:         (Fn [-> (U Message$RecipientType nil)]))


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 09/Sep/13 3:45 AM ]

This is not an issue with inner class syntax.

This is rather about nilable fields. TO here is a static field, nilable-param only takes methods.

core.typed doesn't yet support overriding fields.

Comment by Ambrose Bonnaire-Sergeant [ 09/Sep/13 3:47 AM ]

Related: http://dev.clojure.org/jira/browse/CTYP-50





[CTYP-20] Missing :require of clojure.main? Created: 20/Mar/13  Updated: 25/Sep/13  Resolved: 25/Mar/13

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

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


 Description   

Affects version 0.1.8 (but version isn't listed as a valid version in JIRA)

clojure.core.typed refers to clojure.main/repl (line 725 in master)

However clojure.main is not required by the clojure.core.typed namespace, so you get an error if clojure.main has not already been loaded. This can happen in various circumstances, e.g. running "mvn test"

Code to reproduce / fix:

(ns some.namespace
(:require [clojure.main]) ;; this line is needed to avoid an error
(:require [clojure.core.typed :refer [ann inst cf fn> pfn> check-ns ann-form]]))



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 25/Mar/13 3:05 AM ]

Thanks for the report, fixed.

https://github.com/clojure/core.typed/commit/59f4f5b216a45c2ace5dfbe088dc10796ad565b0





Generated at Fri Sep 04 18:23:51 CDT 2015 using JIRA 4.4#649-r158309.