Visit super arguments even when no signature exists (#24591)

This commit is contained in:
Wesley Wigham 2018-06-01 14:14:56 -07:00 committed by GitHub
parent f8503f2632
commit 1b6d9229f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 0 deletions

View File

@ -18678,6 +18678,7 @@ namespace ts {
if (node.expression.kind === SyntaxKind.SuperKeyword) {
const superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
forEach(node.arguments, checkExpression); // Still visit arguments so they get marked for visibility, etc
return anySignature;
}
if (superType !== errorType) {

View File

@ -0,0 +1,17 @@
tests/cases/compiler/importNotElidedWhenNotFound.ts(1,15): error TS2307: Cannot find module 'file'.
tests/cases/compiler/importNotElidedWhenNotFound.ts(2,15): error TS2307: Cannot find module 'other_file'.
==== tests/cases/compiler/importNotElidedWhenNotFound.ts (2 errors) ====
import X from 'file';
~~~~~~
!!! error TS2307: Cannot find module 'file'.
import Z from 'other_file';
~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'other_file'.
class Y extends Z {
constructor() {
super(X);
}
}

View File

@ -0,0 +1,32 @@
//// [importNotElidedWhenNotFound.ts]
import X from 'file';
import Z from 'other_file';
class Y extends Z {
constructor() {
super(X);
}
}
//// [importNotElidedWhenNotFound.js]
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var file_1 = require("file");
var other_file_1 = require("other_file");
var Y = /** @class */ (function (_super) {
__extends(Y, _super);
function Y() {
return _super.call(this, file_1["default"]) || this;
}
return Y;
}(other_file_1["default"]));

View File

@ -0,0 +1,16 @@
=== tests/cases/compiler/importNotElidedWhenNotFound.ts ===
import X from 'file';
>X : Symbol(X, Decl(importNotElidedWhenNotFound.ts, 0, 6))
import Z from 'other_file';
>Z : Symbol(Z, Decl(importNotElidedWhenNotFound.ts, 1, 6))
class Y extends Z {
>Y : Symbol(Y, Decl(importNotElidedWhenNotFound.ts, 1, 27))
>Z : Symbol(Z, Decl(importNotElidedWhenNotFound.ts, 1, 6))
constructor() {
super(X);
>X : Symbol(X, Decl(importNotElidedWhenNotFound.ts, 0, 6))
}
}

View File

@ -0,0 +1,18 @@
=== tests/cases/compiler/importNotElidedWhenNotFound.ts ===
import X from 'file';
>X : any
import Z from 'other_file';
>Z : any
class Y extends Z {
>Y : Y
>Z : any
constructor() {
super(X);
>super(X) : void
>super : any
>X : any
}
}

View File

@ -0,0 +1,8 @@
import X from 'file';
import Z from 'other_file';
class Y extends Z {
constructor() {
super(X);
}
}