ClojureScript

Externs inference warnings for defrecord and deftype

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: 1.10.238
  • Fix Version/s: None
  • Component/s: 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

Activity

Hide
David Nolen added a comment -

Does this also apply to deftype?

Show
David Nolen added a comment - Does this also apply to deftype?
Hide
Mike Fikes added a comment -

Updated ticket title / description to cover the warning generated for deftype.

Show
Mike Fikes added a comment - Updated ticket title / description to cover the warning generated for deftype.
Hide
Thomas Heller added a comment -

IIRC case, satisfies?, maybe implements? also produce infer warnings.

(case thing
  :foo :foo)

I fixed a lot of these in shadow-cljs but never got to actually producing a patch for them. At this point I forgot what the changes were though.

Show
Thomas Heller added a comment - IIRC case, satisfies?, maybe implements? also produce infer warnings.
(case thing
  :foo :foo)
I fixed a lot of these in shadow-cljs but never got to actually producing a patch for them. At this point I forgot what the changes were though.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: