Use of private deftype by public function in another namespace when inside an if causes warning

Description

I've not been able to get this any smaller, with these two files:

Running `clj -M --main cljs.main --compile hello-world.core` will give this warning:

This bug goes away if you:

  • Change to `(not (object? x))` and move the call to `some-type` into the `else` position

  • Always call `some-type`

So it's specifically about the output produced by `if`.

Environment

None

Activity

Show:
Dominic Monroe
October 13, 2020, 11:03 AM

I’ve dug in a little, problem seems to stem from the call to type? here: https://github.com/clojure/clojurescript/blob/5e88d3383e0f950c4de410d3d6ee11769f3714f4/src/main/clojure/cljs/analyzer.cljc#L1398

 

type? attempts to resolve the var of the type here: https://github.com/clojure/clojurescript/blob/5e88d3383e0f950c4de410d3d6ee11769f3714f4/src/main/clojure/cljs/analyzer.cljc#L1364 but that returned type might be private, hence triggering the warning.

Dominic Monroe
October 14, 2020, 8:29 AM

I’ve uploaded a patch which suppresses private-var-access warnings when “type?” resolves a var by using “with-warning-handlers”.

Assignee

Unassigned

Reporter

Dominic Monroe

Labels

None

Approval

None

Patch

None

Priority

Major
Configure