-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
This is the same code as what originally prompted #2997
While it isn't crashing because of infinite loops any more, it has become very slow with 1.7. If I pause it in the debugger I see the following stack repeating many times.
inferFromTypes [tsc.js] Line 15334 JavaScript
inferFromTypes [tsc.js] Line 15314 JavaScript
inferFromTypes [tsc.js] Line 15301 JavaScript
inferFromProperties [tsc.js] Line 15350 JavaScript
inferFromTypes [tsc.js] Line 15334 JavaScript
inferFromTypes [tsc.js] Line 15314 JavaScript
inferFromTypes [tsc.js] Line 15301 JavaScript
inferFromIndexTypes [tsc.js] Line 15380 JavaScript
inferFromTypes [tsc.js] Line 15337 JavaScript
inferFromProperties [tsc.js] Line 15350 JavaScript
Reduced test case:
class Module {
public members: { [name: string]: FFunction | Property };
}
class Namespace {
public members: { [name: string]: Class | Enum };
}
class Class {
public parent: Module | Namespace;
public members: { [name: string]: Property | FFunction };
}
class Interface {
public members: { [name: string]: Property | FFunction };
}
class FFunction {
public parent: Module | Namespace | Class | Interface; // (1)
}
class Property {
public parent: Module | Namespace | Class | Interface; // (2)
}
class Enum {
public parent: Module | Namespace;
public members: EnumMember[];
}
class EnumMember {
public parent: Enum;
}
var members: (Property | FFunction)[];
members.map(member => "");
Compile with tsc foo.ts
on node 4.2.2 x64 on Windows 7.
This takes ~18s on my machine. If I remove Module
from the union type at (1), it drops to ~12s. Removing Module
at (2) drops it to ~6s. And so on.
The original code is at https://github.com/Arnavion/libjass/blob/82f3706/build/typescript/ast.ts which has a much more complicated forest of types. It's been compiling for 5 minutes now, whereas it took ~2s with 1.6
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue