google / google/closure-compiler

Error in check for incompatible types in super interfaces

Open
#831 1 comment 0 reactions 0 assignees View on GitHub
Types
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.