Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always visit _all_ super arguments #24802

Merged
merged 1 commit into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18620,7 +18620,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
forEach(node.arguments, checkExpresionNoReturn); // Still visit arguments so they get marked for visibility, etc
return anySignature;
}
if (superType !== errorType) {
Expand Down Expand Up @@ -20781,6 +20781,10 @@ namespace ts {
return type;
}

function checkExpresionNoReturn(node: Expression) {
checkExpression(node);
}

// Checks an expression and returns its type. The contextualMapper parameter serves two purposes: When
// contextualMapper is not undefined and not equal to the identityMapper function object it indicates that the
// expression is being inferentially typed (section 4.15.2 in spec) and provides the type mapper to use in
Expand Down
19 changes: 17 additions & 2 deletions tests/baselines/reference/importNotElidedWhenNotFound.errors.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
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(10,16): error TS2307: Cannot find module 'file2'.
tests/cases/compiler/importNotElidedWhenNotFound.ts(11,16): error TS2307: Cannot find module 'file3'.


==== tests/cases/compiler/importNotElidedWhenNotFound.ts (2 errors) ====
==== tests/cases/compiler/importNotElidedWhenNotFound.ts (4 errors) ====
import X from 'file';
~~~~~~
!!! error TS2307: Cannot find module 'file'.
Expand All @@ -14,4 +16,17 @@ tests/cases/compiler/importNotElidedWhenNotFound.ts(2,15): error TS2307: Cannot
constructor() {
super(X);
}
}
}

import X2 from 'file2';
~~~~~~~
!!! error TS2307: Cannot find module 'file2'.
import X3 from 'file3';
~~~~~~~
!!! error TS2307: Cannot find module 'file3'.
class Q extends Z {
constructor() {
super(X2, X3);
}
}

20 changes: 19 additions & 1 deletion tests/baselines/reference/importNotElidedWhenNotFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ class Y extends Z {
constructor() {
super(X);
}
}
}

import X2 from 'file2';
import X3 from 'file3';
class Q extends Z {
constructor() {
super(X2, X3);
}
}


//// [importNotElidedWhenNotFound.js]
"use strict";
Expand All @@ -30,3 +39,12 @@ var Y = /** @class */ (function (_super) {
}
return Y;
}(other_file_1["default"]));
var file2_1 = require("file2");
var file3_1 = require("file3");
var Q = /** @class */ (function (_super) {
__extends(Q, _super);
function Q() {
return _super.call(this, file2_1["default"], file3_1["default"]) || this;
}
return Q;
}(other_file_1["default"]));
18 changes: 18 additions & 0 deletions tests/baselines/reference/importNotElidedWhenNotFound.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,21 @@ class Y extends Z {
>X : Symbol(X, Decl(importNotElidedWhenNotFound.ts, 0, 6))
}
}

import X2 from 'file2';
>X2 : Symbol(X2, Decl(importNotElidedWhenNotFound.ts, 9, 6))

import X3 from 'file3';
>X3 : Symbol(X3, Decl(importNotElidedWhenNotFound.ts, 10, 6))

class Q extends Z {
>Q : Symbol(Q, Decl(importNotElidedWhenNotFound.ts, 10, 23))
>Z : Symbol(Z, Decl(importNotElidedWhenNotFound.ts, 1, 6))

constructor() {
super(X2, X3);
>X2 : Symbol(X2, Decl(importNotElidedWhenNotFound.ts, 9, 6))
>X3 : Symbol(X3, Decl(importNotElidedWhenNotFound.ts, 10, 6))
}
}

20 changes: 20 additions & 0 deletions tests/baselines/reference/importNotElidedWhenNotFound.types
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,23 @@ class Y extends Z {
>X : any
}
}

import X2 from 'file2';
>X2 : any

import X3 from 'file3';
>X3 : any

class Q extends Z {
>Q : Q
>Z : any

constructor() {
super(X2, X3);
>super(X2, X3) : void
>super : any
>X2 : any
>X3 : any
}
}

10 changes: 9 additions & 1 deletion tests/cases/compiler/importNotElidedWhenNotFound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@ class Y extends Z {
constructor() {
super(X);
}
}
}

import X2 from 'file2';
import X3 from 'file3';
class Q extends Z {
constructor() {
super(X2, X3);
}
}