Clojure

Preserve type hints set on inlined or interop forms

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.1
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

Currently one can't hint forms which are expanded by the compiler (interop sugar and inlines):

  • on instance methods:
    user=> (.size #^java.util.ArrayList (.clone (java.util.ArrayList.)))
    Reflection warning, NO_SOURCE_PATH:2 - reference to field size can't be resolved.
  • on static methods:
    user=> (.nth #^clojure.lang.Indexed (clojure.lang.RT/conj [] 2) (int 0))
    Reflection warning, NO_SOURCE_PATH:21 - call to nth can't be resolved.
  • on instance fields:
    user=> (.count #^clojure.lang.Counted (.val (clojure.lang.Box. [])))
    Reflection warning, NO_SOURCE_PATH:23 - reference to field count can't be resolved.
  • on static fields:
    user=> #(.withMeta #^clojure.lang.AFn clojure.lang.RT/EMPTY_GEN nil)
    Reflection warning, NO_SOURCE_PATH:18 - call to withMeta can't be resolved.
  • on inlines;
    user=> (.count #^clojure.lang.Counted (aget (into-array [[]]) 0))
    Reflection warning, NO_SOURCE_PATH:33 - reference to field count can't be resolved.

Discussed on #clojure http://clojure-log.n01se.net/date/2009-10-22.html#08:18

Activity

Hide
Assembla Importer added a comment -
Show
Assembla Importer added a comment - Converted from http://www.assembla.com/spaces/clojure/tickets/205 Attachments: 0001-Preserve-type-hints-set-on-inlined-or-interop-forms-.patch - https://www.assembla.com/spaces/clojure/documents/aqWBuKWaqr3OFEeJe5aVNr/download/aqWBuKWaqr3OFEeJe5aVNr
Hide
Assembla Importer added a comment -

cgrand said: [file:aqWBuKWaqr3OFEeJe5aVNr]: patch

Show
Assembla Importer added a comment - cgrand said: [file:aqWBuKWaqr3OFEeJe5aVNr]: patch
Hide
Assembla Importer added a comment -

cgrand said: I have a related patch now that this point is fixed which make -> and ->> preserve metadata when splicing a list. Should I open another ticket for that? see http://github.com/cgrand/clojure/commit/a027636d9ef857ee80cb13190731a2801684fe9c

Show
Assembla Importer added a comment - cgrand said: I have a related patch now that this point is fixed which make -> and ->> preserve metadata when splicing a list. Should I open another ticket for that? see http://github.com/cgrand/clojure/commit/a027636d9ef857ee80cb13190731a2801684fe9c
Hide
Assembla Importer added a comment -

cgrand said: (In [[r:4115b53938c56e282b9de9701a2db474324092bd]]) Preserve type hints set on inlined or interop forms, fixes #205

Signed-off-by: Chouser <chouser@n01se.net>

Branch: master

Show
Assembla Importer added a comment - cgrand said: (In [[r:4115b53938c56e282b9de9701a2db474324092bd]]) Preserve type hints set on inlined or interop forms, fixes #205 Signed-off-by: Chouser <chouser@n01se.net> Branch: master

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: