google / google/closure-compiler

The current type checker fails to detect a type mismatch involving type interface

Open
#980 4 comments 0 reactions 0 assignees View on GitHub
OTI Types
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

The last two assignments in function `f` should trigger warnings in the current type system.

``` javascript
/**
* @interface
* @template KEY1, VALUE1
*/
var IObject = function() {};

/**
* @interface
* @extends {IObject}
* @template VALUE2
*/
var IArrayLike = function() {};

/**
* @constructor
* @implements {IArrayLike}
*/
function Int8Array2() {}

function f() {
/** @type {Int8Array2} */
var x = new Int8Array2();

/** @type {IArrayLike} */
var y;
y = x; // should have a warning here

/** @type {IObject} */
var z;
z = x; // should have a warning here
}
```

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.