loop should retain primitive int or float without widening

Description

In the following example:

the loop-local starts as an int when just a local but is widened to a long in the recur. It should be possible to retain the primitive int (or alternately float) type on the recur, rather than widening to long (or double).

The compiler code that is promoting the int seems to be:
https://github.com/clojure/clojure/blob/a19c36927598677c32099dabd0fdb9d3097df259/src/jvm/clojure/lang/Compiler.java#L6377-L6380

Proposed: remove useless widening on loop bindings

Patch: clj-1905-2.patch

Screened by: Alex Miller. My main open question here is: do we want to support primitive int/float loop vars?

Environment

Possibly older Clojure versions (but not verified).

Assignee

Unassigned

Reporter

Renzo Borgatti

Approval

Screened

Patch

Code and Test

Fix versions

Affects versions

Priority

Minor
Configure