Uploaded image for project: 'ClojureScript'
  1. CLJS-2767

Externs inference warnings for defrecord and deftype

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: 1.10.238
    • Fix versions: None
    • Labels:
      None
    • Environment:

      {:deps {org.clojure/clojurescript {:mvn/version "1.10.238"}}}

      Description

      If you make use of defrecord with externs inference enabled, you end up with several warnings.

      Repro:

      src/foo/core.cljs
      (ns foo.core)
      
      (set! *warn-on-infer* true)
      
      (defrecord Foo [])
      
      $ clj -m cljs.main -co '{:infer-externs true}' -c foo.core
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. other533 -constructor) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. other533 -__extmap) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. Foo -prototype) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      WARNING: Cannot infer target type in expression (. foo.core/Foo -getBasis) at line 5 /Users/mfikes/Desktop/src/foo/core.cljs
      

      Likewise, making use of deftype results in a warning:

      src/bar/core.cljs
      (ns bar.core)
      
      (set! *warn-on-infer* true)
      
      (deftype Bar [])
      
      $ clj -m cljs.main -co '{:infer-externs true}' -c bar.core
      WARNING: Cannot infer target type in expression (. Bar -getBasis) at line 5 /Users/mfikes/Desktop/CLJS-2767/src/bar/core.c
      

        Attachments

          Activity

            People

            • Assignee:
              dnolen David Nolen
              Reporter:
              mfikes Mike Fikes
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: