title: Closure Compiler apparently replaces conditional with incorrect ternary expression
body: <p>I have the following test:</p>
  
  <pre><code>goog.provide('testing.Test');
  
  goog.require('goog.array');
  
  /**
   * @constructor
   */
  testing.Test = function() {
    /**
     * @type {!Array.&lt;number&gt;}
     * @private
     */
    this.array_ = [];
  };
  
  /**
   * @enum {number}
   */
  testing.Test.Constant = {
    ZERO: 0,
    ONE: 1
  };
  
  testing.Test.prototype.run = function() {
    if (goog.array.peek(this.array_) === testing.Test.Constant.ZERO) {
      console.log('last item matches ZERO');
    } else {
      console.log('last item does not match ZERO');
    }
  };
  
  var test = new testing.Test();
  
  console.log(test.run());
  </code></pre>
  
  <p>Compiling with default optimizations and running yields the expected result:</p>
  
  <p>"last item does not match ZERO"</p>
  
  <p>However, compiling with ADVANCED_OPTIMIZATIONS and running yields the unexpected result:</p>
  
  <p>"last item matches ZERO".</p>
  
  <p>I've traced the problem to the output from the optimized compilation:</p>
  
  <pre><code>function b(){this.a=[]}console.log(function(){var a=(new b).a;a[a.length-1]?console.log("last item does not match ZERO"):console.log("last item matches ZERO")}());
  </code></pre>
  
  <p>The compiler appears to be replacing the conditional with a ternary, but dropping the equality check.</p>
  
  <p>Is this expected behavior, and if so, what am I missing?</p>
  
  <p>I am running the compiler and library available through the version 20170124.0.0 NPM packages. However every version of the compiler I've tested from NPM gives the same result.</p>
  
  <p>I have an older version of the compiler jarfile that does not show the behavior. My notes suggest that this version was either downloaded or compiled by me from source in early June 2016.</p>