Merge branch 'release-2.0' into Fix9636

This commit is contained in:
Mohamed Hegazy
2016-07-17 23:51:52 -07:00
36 changed files with 616 additions and 90 deletions

1
.gitignore vendored
View File

@@ -50,3 +50,4 @@ internal/
!**/.vscode/tasks.json
!tests/cases/projects/projectOption/**/node_modules
!tests/cases/projects/NodeModulesSearch/**/*
!tests/baselines/reference/project/nodeModules*/**/*

View File

@@ -3160,23 +3160,26 @@ namespace ts {
if (declaration.kind === SyntaxKind.ExportAssignment) {
return links.type = checkExpression((<ExportAssignment>declaration).expression);
}
if (declaration.flags & NodeFlags.JavaScriptFile && declaration.kind === SyntaxKind.JSDocPropertyTag && (<JSDocPropertyTag>declaration).typeExpression) {
return links.type = getTypeFromTypeNode((<JSDocPropertyTag>declaration).typeExpression.type);
}
// Handle variable, parameter or property
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
return unknownType;
}
let type: Type = undefined;
// Handle module.exports = expr or this.p = expr
if (declaration.kind === SyntaxKind.BinaryExpression) {
type = getUnionType(map(symbol.declarations, (decl: BinaryExpression) => checkExpressionCached(decl.right)));
}
else if (declaration.kind === SyntaxKind.PropertyAccessExpression) {
// Declarations only exist for property access expressions for certain
// special assignment kinds
if (declaration.parent.kind === SyntaxKind.BinaryExpression) {
// Handle exports.p = expr or className.prototype.method = expr
type = checkExpressionCached((<BinaryExpression>declaration.parent).right);
}
// Handle certain special assignment kinds, which happen to union across multiple declarations:
// * module.exports = expr
// * exports.p = expr
// * this.p = expr
// * className.prototype.method = expr
if (declaration.kind === SyntaxKind.BinaryExpression ||
declaration.kind === SyntaxKind.PropertyAccessExpression && declaration.parent.kind === SyntaxKind.BinaryExpression) {
type = getUnionType(map(symbol.declarations,
decl => decl.kind === SyntaxKind.BinaryExpression ?
checkExpressionCached((<BinaryExpression>decl).right) :
checkExpressionCached((<BinaryExpression>decl.parent).right)));
}
if (type === undefined) {
@@ -11673,7 +11676,7 @@ namespace ts {
function getInferredClassType(symbol: Symbol) {
const links = getSymbolLinks(symbol);
if (!links.inferredClassType) {
links.inferredClassType = createAnonymousType(undefined, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
links.inferredClassType = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, /*stringIndexType*/ undefined, /*numberIndexType*/ undefined);
}
return links.inferredClassType;
}

View File

@@ -997,6 +997,29 @@ namespace ts {
return sortAndDeduplicateDiagnostics(diagnostics);
}
export interface FormatDiagnosticsHost {
getCurrentDirectory(): string;
getCanonicalFileName(fileName: string): string;
getNewLine(): string;
}
export function formatDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): string {
let output = "";
for (const diagnostic of diagnostics) {
if (diagnostic.file) {
const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
const fileName = diagnostic.file.fileName;
const relativeFileName = convertToRelativePath(fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName));
output += `${ relativeFileName }(${ line + 1 },${ character + 1 }): `;
}
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()) }${ host.getNewLine() }`;
}
return output;
}
export function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string {
if (typeof messageText === "string") {
return messageText;
@@ -1095,13 +1118,13 @@ namespace ts {
// As all these operations happen - and are nested - within the createProgram call, they close over the below variables.
// The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses.
const maxNodeModulesJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 2;
let currentNodeModulesJsDepth = 0;
let currentNodeModulesDepth = 0;
// If a module has some of its imports skipped due to being at the depth limit under node_modules, then track
// this, as it may be imported at a shallower depth later, and then it will need its skipped imports processed.
const modulesWithElidedImports: Map<boolean> = {};
// Track source files that are JavaScript files found by searching under node_modules, as these shouldn't be compiled.
// Track source files that are source files found by searching under node_modules, as these shouldn't be compiled.
const sourceFilesFoundSearchingNodeModules: Map<boolean> = {};
const start = new Date().getTime();
@@ -1918,9 +1941,21 @@ namespace ts {
reportFileNamesDifferOnlyInCasingError(fileName, file.fileName, refFile, refPos, refEnd);
}
// If the file was previously found via a node_modules search, but is now being processed as a root file,
// then everything it sucks in may also be marked incorrectly, and needs to be checked again.
if (file && lookUp(sourceFilesFoundSearchingNodeModules, file.path) && currentNodeModulesDepth == 0) {
sourceFilesFoundSearchingNodeModules[file.path] = false;
if (!options.noResolve) {
processReferencedFiles(file, getDirectoryPath(fileName), isDefaultLib);
processTypeReferenceDirectives(file);
}
modulesWithElidedImports[file.path] = false;
processImportedModules(file, getDirectoryPath(fileName));
}
// See if we need to reprocess the imports due to prior skipped imports
if (file && lookUp(modulesWithElidedImports, file.path)) {
if (currentNodeModulesJsDepth < maxNodeModulesJsDepth) {
else if (file && lookUp(modulesWithElidedImports, file.path)) {
if (currentNodeModulesDepth < maxNodeModulesJsDepth) {
modulesWithElidedImports[file.path] = false;
processImportedModules(file, getDirectoryPath(fileName));
}
@@ -1942,6 +1977,7 @@ namespace ts {
filesByName.set(path, file);
if (file) {
sourceFilesFoundSearchingNodeModules[path] = (currentNodeModulesDepth > 0);
file.path = path;
if (host.useCaseSensitiveFileNames()) {
@@ -2075,13 +2111,10 @@ namespace ts {
const isJsFileFromNodeModules = isFromNodeModulesSearch && hasJavaScriptFileExtension(resolution.resolvedFileName);
if (isFromNodeModulesSearch) {
sourceFilesFoundSearchingNodeModules[resolvedPath] = true;
}
if (isJsFileFromNodeModules) {
currentNodeModulesJsDepth++;
currentNodeModulesDepth++;
}
const elideImport = isJsFileFromNodeModules && currentNodeModulesJsDepth > maxNodeModulesJsDepth;
const elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModulesJsDepth;
const shouldAddFile = resolution && !options.noResolve && i < file.imports.length && !elideImport;
if (elideImport) {
@@ -2096,8 +2129,8 @@ namespace ts {
file.imports[i].end);
}
if (isJsFileFromNodeModules) {
currentNodeModulesJsDepth--;
if (isFromNodeModulesSearch) {
currentNodeModulesDepth--;
}
}
}

View File

@@ -6,9 +6,19 @@ namespace ts {
fileWatcher?: FileWatcher;
}
let reportDiagnostic = reportDiagnosticSimply;
const defaultFormatDiagnosticsHost: FormatDiagnosticsHost = {
getCurrentDirectory: () => sys.getCurrentDirectory(),
getNewLine: () => sys.newLine,
getCanonicalFileName: createGetCanonicalFileName(sys.useCaseSensitiveFileNames)
};
function reportDiagnostics(diagnostics: Diagnostic[], host: CompilerHost): void {
let reportDiagnosticWorker = reportDiagnosticSimply;
function reportDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost) {
reportDiagnosticWorker(diagnostic, host || defaultFormatDiagnosticsHost);
}
function reportDiagnostics(diagnostics: Diagnostic[], host: FormatDiagnosticsHost): void {
for (const diagnostic of diagnostics) {
reportDiagnostic(diagnostic, host);
}
@@ -101,23 +111,8 @@ namespace ts {
return <string>diagnostic.messageText;
}
function getRelativeFileName(fileName: string, host: CompilerHost): string {
return host ? convertToRelativePath(fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName)) : fileName;
}
function reportDiagnosticSimply(diagnostic: Diagnostic, host: CompilerHost): void {
let output = "";
if (diagnostic.file) {
const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
const relativeFileName = getRelativeFileName(diagnostic.file.fileName, host);
output += `${ relativeFileName }(${ line + 1 },${ character + 1 }): `;
}
const category = DiagnosticCategory[diagnostic.category].toLowerCase();
output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;
sys.write(output);
function reportDiagnosticSimply(diagnostic: Diagnostic, host: FormatDiagnosticsHost): void {
sys.write(ts.formatDiagnostics([diagnostic], host));
}
const redForegroundEscapeSequence = "\u001b[91m";
@@ -137,7 +132,7 @@ namespace ts {
return formatStyle + text + resetEscapeSequence;
}
function reportDiagnosticWithColorAndContext(diagnostic: Diagnostic, host: CompilerHost): void {
function reportDiagnosticWithColorAndContext(diagnostic: Diagnostic, host: FormatDiagnosticsHost): void {
let output = "";
if (diagnostic.file) {
@@ -145,7 +140,7 @@ namespace ts {
const { line: firstLine, character: firstLineChar } = getLineAndCharacterOfPosition(file, start);
const { line: lastLine, character: lastLineChar } = getLineAndCharacterOfPosition(file, start + length);
const lastLineInFile = getLineAndCharacterOfPosition(file, file.text.length).line;
const relativeFileName = getRelativeFileName(file.fileName, host);
const relativeFileName = host ? convertToRelativePath(file.fileName, host.getCurrentDirectory(), fileName => host.getCanonicalFileName(fileName)) : file.fileName;
const hasMoreThanFiveLines = (lastLine - firstLine) >= 4;
let gutterWidth = (lastLine + 1 + "").length;
@@ -272,7 +267,7 @@ namespace ts {
if (commandLine.options.locale) {
if (!isJSONSupported()) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale"), /* host */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors);
@@ -303,11 +298,11 @@ namespace ts {
if (commandLine.options.project) {
if (!isJSONSupported()) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project"), /* host */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
if (commandLine.fileNames.length !== 0) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line), /* host */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
@@ -315,14 +310,14 @@ namespace ts {
if (!fileOrDirectory /* current directory "." */ || sys.directoryExists(fileOrDirectory)) {
configFileName = combinePaths(fileOrDirectory, "tsconfig.json");
if (!sys.fileExists(configFileName)) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0, commandLine.options.project), /* host */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
}
else {
configFileName = fileOrDirectory;
if (!sys.fileExists(configFileName)) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_specified_path_does_not_exist_Colon_0, commandLine.options.project), /* host */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
}
@@ -340,7 +335,7 @@ namespace ts {
if (isWatchSet(commandLine.options)) {
if (!sys.watchFile) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* host */ undefined);
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
if (configFileName) {
@@ -393,7 +388,7 @@ namespace ts {
}
if (isWatchSet(configParseResult.options)) {
if (!sys.watchFile) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch"), /* host */ undefined);
sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
}
@@ -432,7 +427,7 @@ namespace ts {
}
if (compilerOptions.pretty) {
reportDiagnostic = reportDiagnosticWithColorAndContext;
reportDiagnosticWorker = reportDiagnosticWithColorAndContext;
}
// reset the cache of existing files
@@ -757,7 +752,7 @@ namespace ts {
const currentDirectory = sys.getCurrentDirectory();
const file = normalizePath(combinePaths(currentDirectory, "tsconfig.json"));
if (sys.fileExists(file)) {
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.A_tsconfig_json_file_is_already_defined_at_Colon_0, file), /* host */ undefined);
}
else {
const compilerOptions = extend(options, defaultInitCompilerOptions);
@@ -777,7 +772,7 @@ namespace ts {
}
sys.writeFile(file, JSON.stringify(configurations, undefined, 4));
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* compilerHost */ undefined);
reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* host */ undefined);
}
return;

View File

@@ -479,17 +479,27 @@ class ProjectRunner extends RunnerBase {
it("Baseline of emitted result (" + moduleNameToString(moduleKind) + "): " + testCaseFileName, () => {
if (testCase.baselineCheck) {
const errs: Error[] = [];
ts.forEach(compilerResult.outputFiles, outputFile => {
Harness.Baseline.runBaseline("Baseline of emitted result (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
try {
return Harness.IO.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
}
catch (e) {
return undefined;
}
});
// There may be multiple files with different baselines. Run all and report at the end, else
// it stops copying the remaining emitted files from 'local/projectOutput' to 'local/project'.
try {
Harness.Baseline.runBaseline("Baseline of emitted result (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
try {
return Harness.IO.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
}
catch (e) {
return undefined;
}
});
}
catch (e) {
errs.push(e);
}
});
if (errs.length) {
throw Error(errs.join("\n "));
}
}
});

View File

@@ -26,7 +26,8 @@ namespace ts.formatting {
RescanGreaterThanToken,
RescanSlashToken,
RescanTemplateToken,
RescanJsxIdentifier
RescanJsxIdentifier,
RescanJsxText,
}
export function getFormattingScanner(sourceFile: SourceFile, startPos: number, endPos: number): FormattingScanner {
@@ -140,6 +141,10 @@ namespace ts.formatting {
return false;
}
function shouldRescanJsxText(node: Node): boolean {
return node && node.kind === SyntaxKind.JsxText;
}
function shouldRescanSlashToken(container: Node): boolean {
return container.kind === SyntaxKind.RegularExpressionLiteral;
}
@@ -176,6 +181,8 @@ namespace ts.formatting {
? ScanAction.RescanTemplateToken
: shouldRescanJsxIdentifier(n)
? ScanAction.RescanJsxIdentifier
: shouldRescanJsxText(n)
? ScanAction.RescanJsxText
: ScanAction.Scan;
if (lastTokenInfo && expectedScanAction === lastScanAction) {
@@ -215,6 +222,10 @@ namespace ts.formatting {
currentToken = scanner.scanJsxIdentifier();
lastScanAction = ScanAction.RescanJsxIdentifier;
}
else if (expectedScanAction === ScanAction.RescanJsxText) {
currentToken = scanner.reScanJsxToken();
lastScanAction = ScanAction.RescanJsxText;
}
else {
lastScanAction = ScanAction.Scan;
}

View File

@@ -0,0 +1,36 @@
//// [input.js]
function Class()
{
}
// error: 'Class' doesn't have property 'notPresent'
Class.prototype.containsError = function () { return this.notPresent; };
// lots of methods that return this, which caused out-of-memory in #9527
Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; };
Class.prototype.m2 = function (x, y) { return this; };
Class.prototype.m3 = function (x, y) { return this; };
Class.prototype.m4 = function (angle) { return this; };
Class.prototype.m5 = function (matrix) { return this; };
Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; };
Class.prototype.m7 = function(matrix) { return this; };
Class.prototype.m8 = function() { return this; };
Class.prototype.m9 = function () { return this; };
//// [output.js]
function Class() {
}
// error: 'Class' doesn't have property 'notPresent'
Class.prototype.containsError = function () { return this.notPresent; };
// lots of methods that return this, which caused out-of-memory in #9527
Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; };
Class.prototype.m2 = function (x, y) { return this; };
Class.prototype.m3 = function (x, y) { return this; };
Class.prototype.m4 = function (angle) { return this; };
Class.prototype.m5 = function (matrix) { return this; };
Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; };
Class.prototype.m7 = function (matrix) { return this; };
Class.prototype.m8 = function () { return this; };
Class.prototype.m9 = function () { return this; };

View File

@@ -0,0 +1,101 @@
=== tests/cases/conformance/salsa/input.js ===
function Class()
>Class : Symbol(Class, Decl(input.js, 0, 0))
{
}
// error: 'Class' doesn't have property 'notPresent'
Class.prototype.containsError = function () { return this.notPresent; };
>Class.prototype : Symbol(Class.containsError, Decl(input.js, 2, 1))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>containsError : Symbol(Class.containsError, Decl(input.js, 2, 1))
>this : Symbol(Class, Decl(input.js, 0, 0))
// lots of methods that return this, which caused out-of-memory in #9527
Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; };
>Class.prototype : Symbol(Class.m1, Decl(input.js, 5, 72))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m1 : Symbol(Class.m1, Decl(input.js, 5, 72))
>a : Symbol(a, Decl(input.js, 8, 31))
>b : Symbol(b, Decl(input.js, 8, 33))
>c : Symbol(c, Decl(input.js, 8, 36))
>d : Symbol(d, Decl(input.js, 8, 39))
>tx : Symbol(tx, Decl(input.js, 8, 42))
>ty : Symbol(ty, Decl(input.js, 8, 46))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m2 = function (x, y) { return this; };
>Class.prototype : Symbol(Class.m2, Decl(input.js, 8, 68))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m2 : Symbol(Class.m2, Decl(input.js, 8, 68))
>x : Symbol(x, Decl(input.js, 9, 31))
>y : Symbol(y, Decl(input.js, 9, 33))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m3 = function (x, y) { return this; };
>Class.prototype : Symbol(Class.m3, Decl(input.js, 9, 54))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m3 : Symbol(Class.m3, Decl(input.js, 9, 54))
>x : Symbol(x, Decl(input.js, 10, 31))
>y : Symbol(y, Decl(input.js, 10, 33))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m4 = function (angle) { return this; };
>Class.prototype : Symbol(Class.m4, Decl(input.js, 10, 54))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m4 : Symbol(Class.m4, Decl(input.js, 10, 54))
>angle : Symbol(angle, Decl(input.js, 11, 31))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m5 = function (matrix) { return this; };
>Class.prototype : Symbol(Class.m5, Decl(input.js, 11, 55))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m5 : Symbol(Class.m5, Decl(input.js, 11, 55))
>matrix : Symbol(matrix, Decl(input.js, 12, 31))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; };
>Class.prototype : Symbol(Class.m6, Decl(input.js, 12, 56))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m6 : Symbol(Class.m6, Decl(input.js, 12, 56))
>x : Symbol(x, Decl(input.js, 13, 31))
>y : Symbol(y, Decl(input.js, 13, 33))
>pivotX : Symbol(pivotX, Decl(input.js, 13, 36))
>pivotY : Symbol(pivotY, Decl(input.js, 13, 44))
>scaleX : Symbol(scaleX, Decl(input.js, 13, 52))
>scaleY : Symbol(scaleY, Decl(input.js, 13, 60))
>rotation : Symbol(rotation, Decl(input.js, 13, 68))
>skewX : Symbol(skewX, Decl(input.js, 13, 78))
>skewY : Symbol(skewY, Decl(input.js, 13, 85))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m7 = function(matrix) { return this; };
>Class.prototype : Symbol(Class.m7, Decl(input.js, 13, 110))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m7 : Symbol(Class.m7, Decl(input.js, 13, 110))
>matrix : Symbol(matrix, Decl(input.js, 14, 30))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m8 = function() { return this; };
>Class.prototype : Symbol(Class.m8, Decl(input.js, 14, 55))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m8 : Symbol(Class.m8, Decl(input.js, 14, 55))
>this : Symbol(Class, Decl(input.js, 0, 0))
Class.prototype.m9 = function () { return this; };
>Class.prototype : Symbol(Class.m9, Decl(input.js, 15, 49))
>Class : Symbol(Class, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m9 : Symbol(Class.m9, Decl(input.js, 15, 49))
>this : Symbol(Class, Decl(input.js, 0, 0))

View File

@@ -0,0 +1,133 @@
=== tests/cases/conformance/salsa/input.js ===
function Class()
>Class : () => void
{
}
// error: 'Class' doesn't have property 'notPresent'
Class.prototype.containsError = function () { return this.notPresent; };
>Class.prototype.containsError = function () { return this.notPresent; } : () => any
>Class.prototype.containsError : any
>Class.prototype : any
>Class : () => void
>prototype : any
>containsError : any
>function () { return this.notPresent; } : () => any
>this.notPresent : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>notPresent : any
// lots of methods that return this, which caused out-of-memory in #9527
Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; };
>Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => { containsError: () => any; m1: any; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m1 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m1 : any
>function (a, b, c, d, tx, ty) { return this; } : (a: any, b: any, c: any, d: any, tx: any, ty: any) => { containsError: () => any; m1: any; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>a : any
>b : any
>c : any
>d : any
>tx : any
>ty : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m2 = function (x, y) { return this; };
>Class.prototype.m2 = function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: any; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m2 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m2 : any
>function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: any; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>x : any
>y : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m3 = function (x, y) { return this; };
>Class.prototype.m3 = function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: any; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m3 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m3 : any
>function (x, y) { return this; } : (x: any, y: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: any; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>x : any
>y : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m4 = function (angle) { return this; };
>Class.prototype.m4 = function (angle) { return this; } : (angle: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: any; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m4 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m4 : any
>function (angle) { return this; } : (angle: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: any; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>angle : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m5 = function (matrix) { return this; };
>Class.prototype.m5 = function (matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: any; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m5 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m5 : any
>function (matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: any; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>matrix : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; };
>Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: any; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m6 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m6 : any
>function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; } : (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: any; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
>x : any
>y : any
>pivotX : any
>pivotY : any
>scaleX : any
>scaleY : any
>rotation : any
>skewX : any
>skewY : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m7 = function(matrix) { return this; };
>Class.prototype.m7 = function(matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: any; m8: () => typeof Class; m9: () => typeof Class; }
>Class.prototype.m7 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m7 : any
>function(matrix) { return this; } : (matrix: any) => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: any; m8: () => typeof Class; m9: () => typeof Class; }
>matrix : any
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m8 = function() { return this; };
>Class.prototype.m8 = function() { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: any; m9: () => typeof Class; }
>Class.prototype.m8 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m8 : any
>function() { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: any; m9: () => typeof Class; }
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }
Class.prototype.m9 = function () { return this; };
>Class.prototype.m9 = function () { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: any; }
>Class.prototype.m9 : any
>Class.prototype : any
>Class : () => void
>prototype : any
>m9 : any
>function () { return this; } : () => { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: any; }
>this : { containsError: () => any; m1: (a: any, b: any, c: any, d: any, tx: any, ty: any) => typeof Class; m2: (x: any, y: any) => typeof Class; m3: (x: any, y: any) => typeof Class; m4: (angle: any) => typeof Class; m5: (matrix: any) => typeof Class; m6: (x: any, y: any, pivotX: any, pivotY: any, scaleX: any, scaleY: any, rotation: any, skewX: any, skewY: any) => typeof Class; m7: (matrix: any) => typeof Class; m8: () => typeof Class; m9: () => typeof Class; }

View File

@@ -8,6 +8,8 @@ export {};
//// [app.ts]
import "A"
//// [index.js]
"use strict";
//// [app.js]
"use strict";
require("A");

View File

@@ -0,0 +1,17 @@
//// [input.js]
function C() {
this.m = null;
}
C.prototype.m = function() {
this.nothing();
};
//// [output.js]
function C() {
this.m = null;
}
C.prototype.m = function () {
this.nothing();
};

View File

@@ -0,0 +1,19 @@
=== tests/cases/conformance/salsa/input.js ===
function C() {
>C : Symbol(C, Decl(input.js, 0, 0))
this.m = null;
>m : Symbol(C.m, Decl(input.js, 1, 14), Decl(input.js, 3, 1))
}
C.prototype.m = function() {
>C.prototype : Symbol(C.m, Decl(input.js, 1, 14), Decl(input.js, 3, 1))
>C : Symbol(C, Decl(input.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>m : Symbol(C.m, Decl(input.js, 1, 14), Decl(input.js, 3, 1))
this.nothing();
>this : Symbol(C, Decl(input.js, 0, 0))
};

View File

@@ -0,0 +1,29 @@
=== tests/cases/conformance/salsa/input.js ===
function C() {
>C : () => void
this.m = null;
>this.m = null : null
>this.m : any
>this : any
>m : any
>null : null
}
C.prototype.m = function() {
>C.prototype.m = function() { this.nothing();} : () => void
>C.prototype.m : any
>C.prototype : any
>C : () => void
>prototype : any
>m : any
>function() { this.nothing();} : () => void
this.nothing();
>this.nothing() : any
>this.nothing : any
>this : { m: () => void; }
>nothing : any
};

View File

@@ -13,7 +13,5 @@ export declare var y;
import y = require("a");
//// [ref.js]
var x = 1;
//// [b.js]
"use strict";

View File

@@ -12,7 +12,5 @@ export declare var y;
//// [b.ts]
import y = require("a");
//// [ref.js]
var x = 1;
//// [b.js]
"use strict";

View File

@@ -31,6 +31,9 @@ exports.x = 1;
//// [file2.js]
"use strict";
exports.y = 1;
//// [file4.js]
"use strict";
exports.z1 = 1;
//// [file1.js]
"use strict";
var file1_1 = require("folder2/file1");

View File

@@ -0,0 +1,10 @@
var m2 = require('m2');
var rel = require('./relative');
/**
* @param {string} p1 The first param
*/
exports.f1 = function (p1) {
return 42;
};
exports.f2 = m2;
exports.rel = rel.relativeProp;

View File

@@ -0,0 +1 @@
exports.relativeProp = true;

View File

@@ -2,5 +2,6 @@ define(["require", "exports", "m1"], function (require, exports, m1) {
"use strict";
m1.f1("test");
m1.f2.a = "10"; // Error: Should be number
m1.rel = 42; // Error: Should be boolean
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".
});

View File

@@ -1,4 +1,5 @@
maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to type 'number'.
maxDepthExceeded/root.ts(4,1): error TS2322: Type 'number' is not assignable to type 'boolean'.
==== entry.js (0 errors) ====
@@ -10,8 +11,12 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to
"person": m3.person
};
==== index.js (0 errors) ====
==== relative.js (0 errors) ====
exports.relativeProp = true;
==== maxDepthExceeded/node_modules/m1/index.js (0 errors) ====
var m2 = require('m2');
var rel = require('./relative');
/**
* @param {string} p1 The first param
@@ -22,11 +27,17 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to
exports.f2 = m2;
==== maxDepthExceeded/root.ts (1 errors) ====
exports.rel = rel.relativeProp;
==== maxDepthExceeded/root.ts (2 errors) ====
import * as m1 from "m1";
m1.f1("test");
m1.f2.a = "10"; // Error: Should be number
~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
m1.rel = 42; // Error: Should be boolean
~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".

View File

@@ -8,10 +8,13 @@
"resolvedInputFiles": [
"lib.d.ts",
"maxDepthExceeded/node_modules/m2/entry.js",
"maxDepthExceeded/node_modules/m1/relative.js",
"maxDepthExceeded/node_modules/m1/index.js",
"maxDepthExceeded/root.ts"
],
"emittedFiles": [
"maxDepthExceeded/root.js"
"maxDepthExceeded/built/node_modules/m1/relative.js",
"maxDepthExceeded/built/node_modules/m1/index.js",
"maxDepthExceeded/built/root.js"
]
}

View File

@@ -0,0 +1,10 @@
var m2 = require('m2');
var rel = require('./relative');
/**
* @param {string} p1 The first param
*/
exports.f1 = function (p1) {
return 42;
};
exports.f2 = m2;
exports.rel = rel.relativeProp;

View File

@@ -0,0 +1 @@
exports.relativeProp = true;

View File

@@ -2,4 +2,5 @@
var m1 = require("m1");
m1.f1("test");
m1.f2.a = "10"; // Error: Should be number
m1.rel = 42; // Error: Should be boolean
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".

View File

@@ -1,4 +1,5 @@
maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to type 'number'.
maxDepthExceeded/root.ts(4,1): error TS2322: Type 'number' is not assignable to type 'boolean'.
==== entry.js (0 errors) ====
@@ -10,8 +11,12 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to
"person": m3.person
};
==== index.js (0 errors) ====
==== relative.js (0 errors) ====
exports.relativeProp = true;
==== maxDepthExceeded/node_modules/m1/index.js (0 errors) ====
var m2 = require('m2');
var rel = require('./relative');
/**
* @param {string} p1 The first param
@@ -22,11 +27,17 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type 'string' is not assignable to
exports.f2 = m2;
==== maxDepthExceeded/root.ts (1 errors) ====
exports.rel = rel.relativeProp;
==== maxDepthExceeded/root.ts (2 errors) ====
import * as m1 from "m1";
m1.f1("test");
m1.f2.a = "10"; // Error: Should be number
~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
m1.rel = 42; // Error: Should be boolean
~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".

View File

@@ -8,10 +8,13 @@
"resolvedInputFiles": [
"lib.d.ts",
"maxDepthExceeded/node_modules/m2/entry.js",
"maxDepthExceeded/node_modules/m1/relative.js",
"maxDepthExceeded/node_modules/m1/index.js",
"maxDepthExceeded/root.ts"
],
"emittedFiles": [
"maxDepthExceeded/root.js"
"maxDepthExceeded/built/node_modules/m1/relative.js",
"maxDepthExceeded/built/node_modules/m1/index.js",
"maxDepthExceeded/built/root.js"
]
}

View File

@@ -19,6 +19,8 @@ MyClass.prototype.optionalParam = function(required, notRequired) {
>notRequired : Symbol(notRequired, Decl(jsDocOptionality.js, 8, 52))
return this;
>this : Symbol(MyClass, Decl(jsDocOptionality.js, 0, 0))
};
let pInst = new MyClass();
>pInst : Symbol(pInst, Decl(jsDocOptionality.js, 11, 3))

View File

@@ -26,27 +26,27 @@ MyClass.prototype.optionalParam = function(required, notRequired) {
>notRequired : string
return this;
>this : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>this : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
};
let pInst = new MyClass();
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>new MyClass() : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>new MyClass() : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>MyClass : () => void
let c1 = pInst.optionalParam('hello')
>c1 : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>pInst.optionalParam('hello') : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>c1 : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello') : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>'hello' : string
let c2 = pInst.optionalParam('hello', null)
>c2 : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>pInst.optionalParam('hello', null) : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>c2 : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello', null) : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => { prop: null; optionalParam: any; }; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>'hello' : string
>null : null

View File

@@ -0,0 +1,21 @@
// @filename: input.js
// @out: output.js
// @allowJs: true
function Class()
{
}
// error: 'Class' doesn't have property 'notPresent'
Class.prototype.containsError = function () { return this.notPresent; };
// lots of methods that return this, which caused out-of-memory in #9527
Class.prototype.m1 = function (a, b, c, d, tx, ty) { return this; };
Class.prototype.m2 = function (x, y) { return this; };
Class.prototype.m3 = function (x, y) { return this; };
Class.prototype.m4 = function (angle) { return this; };
Class.prototype.m5 = function (matrix) { return this; };
Class.prototype.m6 = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) { return this; };
Class.prototype.m7 = function(matrix) { return this; };
Class.prototype.m8 = function() { return this; };
Class.prototype.m9 = function () { return this; };

View File

@@ -0,0 +1,10 @@
// @filename: input.js
// @out: output.js
// @allowJs: true
function C() {
this.m = null;
}
C.prototype.m = function() {
this.nothing();
};

View File

@@ -0,0 +1,18 @@
/// <reference path="fourslash.ts"/>
// @Filename: foo.tsx
////<div><p>'</p><p>{function(){return 1;}]}</p></div>
format.document();
verify.currentFileContentIs("<div><p>'</p><p>{function() { return 1; }]}</p></div>");
/*
< 0
p 1
> 2
' 3
< 4
/ 5
p 6
> 7
*/

View File

@@ -32,16 +32,24 @@
//// var numberLike; numberLike./*numberLike*/
////
//// /** @type {Person} */
//// var p;p./*person*/
//// var p;p./*person*/;
//// p.personName./*personName*/;
//// p.personAge./*personAge*/;
////
//// /** @type {Animal} */
//// var a;a./*animal*/
//// var a;a./*animal*/;
//// a.animalName./*animalName*/;
//// a.animalAge./*animalAge*/;
////
//// /** @type {Cat} */
//// var c;c./*cat*/
//// var c;c./*cat*/;
//// c.catName./*catName*/;
//// c.catAge./*catAge*/;
////
//// /** @type {Dog} */
//// var d;d./*dog*/
//// var d;d./*dog*/;
//// d.dogName./*dogName*/;
//// d.dogAge./*dogAge*/;
goTo.marker('numberLike');
verify.memberListContains('charAt');
@@ -50,15 +58,31 @@ verify.memberListContains('toExponential');
goTo.marker('person');
verify.memberListContains('personName');
verify.memberListContains('personAge');
goTo.marker('personName');
verify.memberListContains('charAt');
goTo.marker('personAge');
verify.memberListContains('toExponential');
goTo.marker('animal');
verify.memberListContains('animalName');
verify.memberListContains('animalAge');
goTo.marker('animalName');
verify.memberListContains('charAt');
goTo.marker('animalAge');
verify.memberListContains('toExponential');
goTo.marker('dog');
verify.memberListContains('dogName');
verify.memberListContains('dogAge');
goTo.marker('dogName');
verify.memberListContains('charAt');
goTo.marker('dogAge');
verify.memberListContains('toExponential');
goTo.marker('cat');
verify.memberListContains('catName');
verify.memberListContains('catAge');
verify.memberListContains('catAge');
goTo.marker('catName');
verify.memberListContains('charAt');
goTo.marker('catAge');
verify.memberListContains('toExponential');

View File

@@ -1,4 +1,5 @@
var m2 = require('m2');
var rel = require('./relative');
/**
* @param {string} p1 The first param
@@ -8,3 +9,5 @@ exports.f1 = function(p1) {
};
exports.f2 = m2;
exports.rel = rel.relativeProp;

View File

@@ -0,0 +1 @@
exports.relativeProp = true;

View File

@@ -1,4 +1,6 @@
import * as m1 from "m1";
m1.f1("test");
m1.f2.a = "10"; // Error: Should be number
m1.rel = 42; // Error: Should be boolean
m1.f2.person.age = "10"; // OK if stopped at 2 modules: person will be "any".

View File

@@ -1,5 +1,9 @@
{
"compilerOptions": {
"allowJs": true
}
"allowJs": true,
"maxNodeModuleJsDepth": 1, // Note: Module m1 is already included as a root file
"outDir": "built"
},
"include": ["**/*"],
"exclude": ["node_modules/m2/**/*"]
}