HoriSun / closure-compiler

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

Overloading parent method #1314

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Why i can't do something like this:

/** @constructor */
function Foo() {}

/**
 * @param {string} a
 * @return {string}
 */
Foo.prototype.get = function (a) { return ''; }

/**
 * @constructor
 * @extends {Foo}
 */
function Foo2() {}

/**
 * @override
 * @param {number} b
 */
Foo2.prototype.get = function (a, b) { return ''; }

***

Warning: JSC_HIDDEN_SUPERCLASS_PROPERTY_MISMATCH: mismatch of the get property 
type and the type of the property it overrides from superclass Foo.

***

I think it's strange behavior. Also, i can't override parent parameters.

/** @constructor */
function Foo() {}

/**
 * @param {string} a
 * @return {string}
 */
Foo.prototype.get = function (a) { return ''; }

/**
 * @constructor
 * @extends {Foo}
 */
function Foo2() {}

/**
 * @override
 * @param {number} a
 */
Foo2.prototype.get = function (a) { return ''; }

Original issue reported on code.google.com by kobez...@gmail.com on 23 Apr 2014 at 5:40

GoogleCodeExporter commented 9 years ago
Issue tracking has been migrated to github. Please make any further comments on 
this issue through https://github.com/google/closure-compiler/issues

Original comment by blic...@google.com on 1 May 2014 at 6:31

GoogleCodeExporter commented 9 years ago

Original comment by blic...@google.com on 1 May 2014 at 6:34