Uploaded image for project: 'core.typed'
  1. CTYP-191

Bad type syntax when parsing types of macro-generated anonymous functions from required namespaces (when the types are composed, for instance (Option AnyInteger))

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: Backlog
    • Components: None
    • Labels:
      None

      Description

          (defmacro lol2 []
            (let [a (list `typed/Option `typed/AnyInteger)]
              `(fn [] :- ~a 1)))
          
          
          (defmacro lol []
            `(fn [] :- (typed/Option typed/AnyInteger) 1))
      
          (clojure.core.typed/def lol*2 :- [-> (typed/Option typed/AnyInteger)]
            (lol2))
          
          (clojure.core.typed/def lol* :- (typed/Option typed/AnyInteger)
            (lol))
      

      I put this code in namespace A, both typecheck without problem.

      When A is depended on by namespace B, when B is checked
      lol*2 is completely fine but lol* crashes with

      "Bad type syntax: (clojure.core.typed/Option clojure.core.typed/AnyInteger)"
      

      The following works fine.

          (defmacro lol**3 []
            `(fn [] :- typed/AnyInteger 1))
          
          (clojure.core.typed/def lol*3 :- typed/AnyInteger
            (lol**3))
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: