We're updating the issue view to help you get more done. 

Perhaps a compiler issue?

Description

It appears that we very occasionally get generated javascript that is invalid. Invalid here means it will compile and run, but during runtime it will throw an error because of missing variable names / null or undefined.

It's really hard / impossible to reliably recreate, and as mentioned only seems to happen once out of every few hundred builds.

The code in question:

1 2 3 4 5 (defn priorities-last-modified [priorities] (last (sort (concat (map :last-modified-date priorities) (mapcat (comp (partial map :last-modified-date) :goals) priorities)))))

(Yes, this is terrible code but it works 99% of the time.)

The erring output looks like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 jT( v([ fG, function(a) { a = uh(a, new E(null, 4, 5, F, [Iu, Zk, fy, LF], null)); a = Lf(BH, a); var b = yg.j( G.j(gs, priorities__$1), mh(Xg.j(Yg.j(G, gs), GA), v([priorities__$1])) ); b = Jf(Gf, b); return new h(null, 2, [LF, a, MN, We(b)], null); } ]) );

A recompile fixes the output and spits out this:

1 2 3 4 5 6 7 8 9 10 11 hT( v([ eG, function(a) { var b = uh(a, new E(null, 4, 5, F, [Hu, $k, dy, KF], null)); a = Lf(zH, b); b = We(Jf(Gf, yg.j(G.j(fs, b), mh(Xg.j(Yg.j(G, fs), FA), v([b]))))); return new h(null, 2, [KF, a, NN, b], null); } ]) );

The issue from the first compilation results in a runtime error of "priorities__$1 is not defined"

We are using

Environment

Sorry, but we're not sure. We use CircleCI which is likely a linux flavor.

shadow-cljs is our build tool at 2.4.10.

Status

Assignee

Unassigned

Reporter

import

Labels

Approval

None

Patch

None

Affects versions

1.10.238

Priority

Minor