google / google/closure-compiler
Error in check for incompatible types in super interfaces
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
When a generic interface (Using a template type) extends two other generic interfaces containing the same compatible methods then the closure compiler (v20150126) complains about incompatible types. Here is a short example:
``` js
/**
* @template T
* @interface
* @extends B.
* @extends C.
*/
function A() {}
/**
* @template T
* @interface
*/
function B() {}
/** @return {T} */
B.prototype.getValue = function() {};
/**
* @template T
* @interface
*/
function C() {}
/** @return {T} */
C.prototype.getValue = function() {};
```
And here is the compiler output:
```
$ jscc test.js -W VERBOSE
test.js:7: WARNING - Interface A has a property getValue with incompatible types in its super interfaces B and C
function A() {}
^
0 error(s), 1 warning(s), 100.0% typed
```
The check works correctly with the new type inference but because of other problems with the new type inference I'm currently still using the default type inference so I hope this bug could be fixed there, too.
Contributor guide
Assessment
This issue has not been assessed yet.