-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
The following code does not cause a warning even though Foo.prototype.foo
's return type appears to be incorrect.
/**
* @interface
* @template T
*/
function Int() {}
/** @return {{prop: T}} */
Int.prototype.foo = function() {};
/**
* @constructor
* @implements {Int<string>}
*/
function Foo() {}
/**
* @return {{prop: number}} // Should be {prop: string}, but no warning
* @override
*/
Foo.prototype.foo = function() {}
Activity
lauraharker commentedon Mar 28, 2018
Turns out this is because the
TemplateTypeMapReplacer
class extendsModificationVisitor
and intentionally (?) sets a boolean property inModificationVisitor
's constructor telling it not to visit properties.closure-compiler/src/com/google/javascript/rhino/jstype/TemplateTypeMapReplacer.java
Line 61 in 4d7a626
closure-compiler/src/com/google/javascript/rhino/jstype/ModificationVisitor.java
Line 61 in 4d7a626