The difference was that the test project was missing the record. I've reopened the issue now that it's reproducible.
Timo Mihaljov April 21, 2015 at 5:36 AM
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.
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
inMyRecord
to any other type, say(t/Promise String)
makesfoo
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