Skip to content

Commit a56fe76

Browse files
authored
Visit super arguments even when no signature exists (#24591) (#24595)
1 parent 760ff36 commit a56fe76

6 files changed

+92
-0
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18603,6 +18603,7 @@ namespace ts {
1860318603
if (node.expression.kind === SyntaxKind.SuperKeyword) {
1860418604
const superType = checkSuperExpression(node.expression);
1860518605
if (isTypeAny(superType)) {
18606+
forEach(node.arguments, checkExpression); // Still visit arguments so they get marked for visibility, etc
1860618607
return anySignature;
1860718608
}
1860818609
if (superType !== unknownType) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
tests/cases/compiler/importNotElidedWhenNotFound.ts(1,15): error TS2307: Cannot find module 'file'.
2+
tests/cases/compiler/importNotElidedWhenNotFound.ts(2,15): error TS2307: Cannot find module 'other_file'.
3+
4+
5+
==== tests/cases/compiler/importNotElidedWhenNotFound.ts (2 errors) ====
6+
import X from 'file';
7+
~~~~~~
8+
!!! error TS2307: Cannot find module 'file'.
9+
import Z from 'other_file';
10+
~~~~~~~~~~~~
11+
!!! error TS2307: Cannot find module 'other_file'.
12+
13+
class Y extends Z {
14+
constructor() {
15+
super(X);
16+
}
17+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//// [importNotElidedWhenNotFound.ts]
2+
import X from 'file';
3+
import Z from 'other_file';
4+
5+
class Y extends Z {
6+
constructor() {
7+
super(X);
8+
}
9+
}
10+
11+
//// [importNotElidedWhenNotFound.js]
12+
"use strict";
13+
var __extends = (this && this.__extends) || (function () {
14+
var extendStatics = Object.setPrototypeOf ||
15+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
16+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
17+
return function (d, b) {
18+
extendStatics(d, b);
19+
function __() { this.constructor = d; }
20+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
21+
};
22+
})();
23+
exports.__esModule = true;
24+
var file_1 = require("file");
25+
var other_file_1 = require("other_file");
26+
var Y = /** @class */ (function (_super) {
27+
__extends(Y, _super);
28+
function Y() {
29+
return _super.call(this, file_1["default"]) || this;
30+
}
31+
return Y;
32+
}(other_file_1["default"]));
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/importNotElidedWhenNotFound.ts ===
2+
import X from 'file';
3+
>X : Symbol(X, Decl(importNotElidedWhenNotFound.ts, 0, 6))
4+
5+
import Z from 'other_file';
6+
>Z : Symbol(Z, Decl(importNotElidedWhenNotFound.ts, 1, 6))
7+
8+
class Y extends Z {
9+
>Y : Symbol(Y, Decl(importNotElidedWhenNotFound.ts, 1, 27))
10+
>Z : Symbol(Z, Decl(importNotElidedWhenNotFound.ts, 1, 6))
11+
12+
constructor() {
13+
super(X);
14+
>X : Symbol(X, Decl(importNotElidedWhenNotFound.ts, 0, 6))
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/compiler/importNotElidedWhenNotFound.ts ===
2+
import X from 'file';
3+
>X : any
4+
5+
import Z from 'other_file';
6+
>Z : any
7+
8+
class Y extends Z {
9+
>Y : Y
10+
>Z : any
11+
12+
constructor() {
13+
super(X);
14+
>super(X) : void
15+
>super : any
16+
>X : any
17+
}
18+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import X from 'file';
2+
import Z from 'other_file';
3+
4+
class Y extends Z {
5+
constructor() {
6+
super(X);
7+
}
8+
}

0 commit comments

Comments
 (0)