So this is the compilation I'm getting inside my larger project under :optimizations :simple (cljs 1.7.28)
The real problem is this:
Line 7 of the output code sets $_STAR_format_str_STAR_27199$$ = $_STAR_format_str_STAR_27199$$.indexOf("~") for line 12 in the input code of (let [tilde (.indexOf s \~)] ...).
Now, $_STAR_format_str_STAR_27199$$ seems to be standing in for s in the input code. Why is closure renaming tilde into overwriting s?
Later, at the end of line 9 (output) or line 15 (input), (subs s 1) / cljs.core.subs.call(null, $_STAR_format_str_STAR_27199$$, 1) causes an error because we have tilde, s and *format-str* sharing a variable name.