Can't create a promise of the same type as a record field

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

Environment

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

Attachments

1

Activity

Show:

Timo Mihaljov April 22, 2015 at 6:39 AM

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.

Completed

Details

Assignee

Reporter

Patch

Code and Test

Components

Fix versions

Priority

Created April 21, 2015 at 5:12 AM
Updated December 3, 2017 at 11:06 PM
Resolved December 3, 2017 at 11:06 PM