core.typed

Parameterise IFn instead of special function type.

Details

  • Type: Task Task
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: 0.2.0
  • Component/s: None
  • Labels:
    None

Activity

Ambrose Bonnaire-Sergeant made changes -
Field Original Value New Value
Priority Blocker [ 1 ] Minor [ 4 ]
Hide
Chris Spencer added a comment -

Need to support primitive hinted functions too:

user=> (defn f [^long x] x)
#'user/f
user=> (clojure.tools.analyzer/analyze-form '(fn [] (f 5)))
{:op :fn-expr, :env {:line 1, :locals {}, :ns {:name user}}, :methods ({:op :fn-method, :env {:locals {}, :ns {:name user}}, :body {:op :do, :env {:source "NO_SOURCE_FILE", :column 46, :line 1, :locals {}, :ns {:name user}}, :exprs ({:op :instance-method, :env {:source "NO_SOURCE_FILE", :column 46, :line 1, :locals {}, :ns {:name user}}, :target {:op :var, :env {:locals {}, :ns {:name user}}, :var #'user/f, :tag clojure.lang.IFn$LO}, :method-name "invokePrim", :method #clojure.reflect.Method{:name invokePrim, :return-type java.lang.Object, :declaring-class clojure.lang.IFn$LO, :parameter-types [long], :exception-types [], :flags #{:public :abstract}}, :args ({:op :number, :env {:locals {}, :ns {:name user}}, :val 5}), :tag nil})}, :required-params (), :rest-param nil}), :variadic-method nil, :tag nil}
Show
Chris Spencer added a comment - Need to support primitive hinted functions too:
user=> (defn f [^long x] x)
#'user/f
user=> (clojure.tools.analyzer/analyze-form '(fn [] (f 5)))
{:op :fn-expr, :env {:line 1, :locals {}, :ns {:name user}}, :methods ({:op :fn-method, :env {:locals {}, :ns {:name user}}, :body {:op :do, :env {:source "NO_SOURCE_FILE", :column 46, :line 1, :locals {}, :ns {:name user}}, :exprs ({:op :instance-method, :env {:source "NO_SOURCE_FILE", :column 46, :line 1, :locals {}, :ns {:name user}}, :target {:op :var, :env {:locals {}, :ns {:name user}}, :var #'user/f, :tag clojure.lang.IFn$LO}, :method-name "invokePrim", :method #clojure.reflect.Method{:name invokePrim, :return-type java.lang.Object, :declaring-class clojure.lang.IFn$LO, :parameter-types [long], :exception-types [], :flags #{:public :abstract}}, :args ({:op :number, :env {:locals {}, :ns {:name user}}, :val 5}), :tag nil})}, :required-params (), :rest-param nil}), :variadic-method nil, :tag nil}

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: