<< Back to previous view

[CTYP-33] A var of containing a function should be a subtype of the function Created: 07/Aug/13  Updated: 25/Sep/13  Resolved: 28/Aug/13

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

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


 Description   

Vars implement IFn by delegating to the function they contain. Thus a var is a valid value anywhere its contained function is valid.

Currently core.typed does not allow treating vars as functions:

(t/cf + [Number * -> Number])
;= (Fn [Number * -> Number])

(t/cf #'+ [Number * -> Number])
; Type Error (user:1:1) Expected type: (Fn [Number * -> Number])
; Actual: Var
; in: (var clojure.core/+)
;
;
; Type Error (user:1:1) Expected type: (Fn [Number * -> Number])
; Actual: Var
; in: (var clojure.core/+)
;
;
; ExceptionInfo Type Checker: Found 2 errors  clojure.core/ex-info (core.clj:4327)


 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 28/Aug/13 8:42 AM ]

Fixed https://github.com/clojure/core.typed/commit/2dd93b6946dbeb3b6741c44f0374cd580919b3ef#L3R1855

Generated at Mon Sep 15 23:59:10 CDT 2014 using JIRA 4.4#649-r158309.