HoriSun / closure-compiler

Automatically exported from code.google.com/p/closure-compiler
0 stars 0 forks source link

Failure to identify call of a missing method #1229

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Closure fails to detect the call of [a missing] dOneMethod() on a B object. 
Looks like a serious issue...

/**
 * @constructor
 */
var B = function() {}

/**
 * @constructor
 * @extends {B}
 */
var D1 = function() {
    B.call(this);
}

D1.prototype = {
    dOneMethod: function() {},

    __proto__: B.prototype
}

/**
 * @constructor
 * @extends {B}
 */
var D2 = function() {
    B.call(this);
}

D2.prototype = {
    __proto__: B.prototype
}

/**
 * @param {!B} bObject
 */
function badCode(bObject)
{
    bObject.dOneMethod();
}

badCode(new D2());

Original issue reported on code.google.com by apav...@chromium.org on 10 Feb 2014 at 9:30

GoogleCodeExporter commented 9 years ago
this is working as designed; see discussion on issue 179

Original comment by Nicholas.J.Santos on 10 Feb 2014 at 2:35