diff --git a/lib/tsc.js b/lib/tsc.js index be8721336d0d3..43f150dd77aec 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -142,7 +142,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.3.4"; + ts.version = "2.3.5"; })(ts || (ts = {})); (function (ts) { ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; @@ -53897,9 +53897,9 @@ var ts; } var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; - var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); - var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + var includeBindAndCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); diff --git a/lib/tsserver.js b/lib/tsserver.js index 19241091ec7ce..0e654529be88e 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -1106,7 +1106,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.3.4"; + ts.version = "2.3.5"; })(ts || (ts = {})); (function (ts) { var Ternary; @@ -55281,9 +55281,9 @@ var ts; } var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; - var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); - var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + var includeBindAndCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index b6738def57e52..d6de1acd35a7b 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -2275,7 +2275,7 @@ declare namespace ts { } } declare namespace ts { - const version = "2.3.4"; + const version = "2.3.5"; } declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; declare function clearTimeout(handle: any): void; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 2a052751651ae..0aecf56ca7009 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -1106,7 +1106,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.3.4"; + ts.version = "2.3.5"; })(ts || (ts = {})); (function (ts) { var Ternary; @@ -56665,9 +56665,9 @@ var ts; } var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; - var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); - var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + var includeBindAndCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 2148a040d3374..8e5d693129f99 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -2519,7 +2519,7 @@ declare namespace ts { } declare namespace ts { /** The version of the TypeScript compiler release */ - const version = "2.3.4"; + const version = "2.3.5"; } declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; declare function clearTimeout(handle: any): void; diff --git a/lib/typescript.js b/lib/typescript.js index d2840acde85db..f652fbabfc9d9 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -1262,7 +1262,7 @@ var ts; var ts; (function (ts) { /** The version of the TypeScript compiler release */ - ts.version = "2.3.4"; + ts.version = "2.3.5"; })(ts || (ts = {})); /* @internal */ (function (ts) { @@ -67476,10 +67476,10 @@ var ts; } var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; // For JavaScript files, we don't want to report semantic errors unless explicitly requested. - var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); - var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + var includeBindAndCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 25345e1f5b65f..ef1da64857e79 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -2519,7 +2519,7 @@ declare namespace ts { } declare namespace ts { /** The version of the TypeScript compiler release */ - const version = "2.3.4"; + const version = "2.3.5"; } declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; declare function clearTimeout(handle: any): void; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index d2840acde85db..f652fbabfc9d9 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -1262,7 +1262,7 @@ var ts; var ts; (function (ts) { /** The version of the TypeScript compiler release */ - ts.version = "2.3.4"; + ts.version = "2.3.5"; })(ts || (ts = {})); /* @internal */ (function (ts) { @@ -67476,10 +67476,10 @@ var ts; } var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); - var bindDiagnostics = sourceFile.bindDiagnostics; // For JavaScript files, we don't want to report semantic errors unless explicitly requested. - var includeCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); - var checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + var includeBindAndCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index cc60f08af6e01..f1d365b15e76d 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -152,7 +152,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.3.4"; + ts.version = "2.3.5"; })(ts || (ts = {})); (function (ts) { ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; diff --git a/package.json b/package.json index 52531aa024bb5..e5079aa9285d5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "2.3.4", + "version": "2.3.5", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d777d4ea71204..1839fdc6aadd9 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -3,7 +3,7 @@ namespace ts { /** The version of the TypeScript compiler release */ - export const version = "2.3.4"; + export const version = "2.3.5"; } /* @internal */ diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 347e6e97ebd81..5d563d455155d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -918,10 +918,10 @@ namespace ts { const typeChecker = getDiagnosticsProducingTypeChecker(); Debug.assert(!!sourceFile.bindDiagnostics); - const bindDiagnostics = sourceFile.bindDiagnostics; // For JavaScript files, we don't want to report semantic errors unless explicitly requested. - const includeCheckDiagnostics = !isSourceFileJavaScript(sourceFile) || isCheckJsEnabledForFile(sourceFile, options); - const checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : []; + const includeBindAndCheckDiagnostics = !isSourceFileJavaScript(sourceFile) || isCheckJsEnabledForFile(sourceFile, options); + const bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; + const checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; const fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); diff --git a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt index 05fecf03d3069..9a9a7a12db9ca 100644 --- a/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt +++ b/tests/baselines/reference/jsFileCompilationBindMultipleDefaultExports.errors.txt @@ -1,15 +1,21 @@ tests/cases/compiler/a.js(1,22): error TS2528: A module cannot have multiple default exports. +tests/cases/compiler/a.js(1,22): error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. tests/cases/compiler/a.js(3,1): error TS2528: A module cannot have multiple default exports. tests/cases/compiler/a.js(3,16): error TS1109: Expression expected. +tests/cases/compiler/a.js(3,20): error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. -==== tests/cases/compiler/a.js (3 errors) ==== +==== tests/cases/compiler/a.js (5 errors) ==== export default class a { ~ !!! error TS2528: A module cannot have multiple default exports. + ~ +!!! error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. } export default var a = 10; ~~~~~~~~~~~~~~ !!! error TS2528: A module cannot have multiple default exports. ~~~ -!!! error TS1109: Expression expected. \ No newline at end of file +!!! error TS1109: Expression expected. + ~ +!!! error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt index d681cec3775b0..ed19b5c4a9b89 100644 --- a/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt +++ b/tests/baselines/reference/jsFileCompilationBindStrictModeErrors.errors.txt @@ -1,9 +1,12 @@ tests/cases/compiler/a.js(5,5): error TS1117: An object literal cannot have multiple properties with the same name in strict mode. +tests/cases/compiler/a.js(5,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/a.js(7,5): error TS1212: Identifier expected. 'let' is a reserved word in strict mode. tests/cases/compiler/a.js(8,8): error TS1102: 'delete' cannot be called on an identifier in strict mode. +tests/cases/compiler/a.js(8,8): error TS2703: The operand of a delete operator must be a property reference. tests/cases/compiler/a.js(10,10): error TS1100: Invalid use of 'eval' in strict mode. tests/cases/compiler/a.js(12,10): error TS1100: Invalid use of 'arguments' in strict mode. tests/cases/compiler/a.js(15,1): error TS1101: 'with' statements are not allowed in strict mode. +tests/cases/compiler/a.js(15,1): error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. tests/cases/compiler/b.js(3,7): error TS1210: Invalid use of 'eval'. Class definitions are automatically in strict mode. tests/cases/compiler/b.js(6,13): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/c.js(1,12): error TS1214: Identifier expected. 'let' is a reserved word in strict mode. Modules are automatically in strict mode. @@ -12,7 +15,7 @@ tests/cases/compiler/d.js(2,9): error TS1121: Octal literals are not allowed in tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. -==== tests/cases/compiler/a.js (6 errors) ==== +==== tests/cases/compiler/a.js (9 errors) ==== "use strict"; var a = { a: "hello", // error @@ -20,6 +23,8 @@ tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. a: 10 // error ~ !!! error TS1117: An object literal cannot have multiple properties with the same name in strict mode. + ~ +!!! error TS2300: Duplicate identifier 'a'. }; var let = 10; // error ~~~ @@ -27,6 +32,8 @@ tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. delete a; // error ~ !!! error TS1102: 'delete' cannot be called on an identifier in strict mode. + ~ +!!! error TS2703: The operand of a delete operator must be a property reference. try { } catch (eval) { // error ~~~~ @@ -40,6 +47,8 @@ tests/cases/compiler/d.js(2,11): error TS1005: ',' expected. with (a) { ~~~~ !!! error TS1101: 'with' statements are not allowed in strict mode. + ~~~~~~~~ +!!! error TS2410: The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'. b = 10; } diff --git a/tests/baselines/reference/unreachableJavascriptChecked.errors.txt b/tests/baselines/reference/unreachableJavascriptChecked.errors.txt new file mode 100644 index 0000000000000..c66b342177fcd --- /dev/null +++ b/tests/baselines/reference/unreachableJavascriptChecked.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/unreachable.js(3,5): error TS7027: Unreachable code detected. + + +==== tests/cases/compiler/unreachable.js (1 errors) ==== + function unreachable() { + return 1; + return 2; + ~~~~~~ +!!! error TS7027: Unreachable code detected. + } \ No newline at end of file diff --git a/tests/baselines/reference/unreachableJavascriptChecked.js b/tests/baselines/reference/unreachableJavascriptChecked.js new file mode 100644 index 0000000000000..6bf264bf3d22c --- /dev/null +++ b/tests/baselines/reference/unreachableJavascriptChecked.js @@ -0,0 +1,11 @@ +//// [unreachable.js] +function unreachable() { + return 1; + return 2; +} + +//// [unreachable.js] +function unreachable() { + return 1; + return 2; +} diff --git a/tests/baselines/reference/unreachableJavascriptUnchecked.js b/tests/baselines/reference/unreachableJavascriptUnchecked.js new file mode 100644 index 0000000000000..6bf264bf3d22c --- /dev/null +++ b/tests/baselines/reference/unreachableJavascriptUnchecked.js @@ -0,0 +1,11 @@ +//// [unreachable.js] +function unreachable() { + return 1; + return 2; +} + +//// [unreachable.js] +function unreachable() { + return 1; + return 2; +} diff --git a/tests/baselines/reference/unreachableJavascriptUnchecked.symbols b/tests/baselines/reference/unreachableJavascriptUnchecked.symbols new file mode 100644 index 0000000000000..f2db6a6a3477f --- /dev/null +++ b/tests/baselines/reference/unreachableJavascriptUnchecked.symbols @@ -0,0 +1,7 @@ +=== tests/cases/compiler/unreachable.js === +function unreachable() { +>unreachable : Symbol(unreachable, Decl(unreachable.js, 0, 0)) + + return 1; + return 2; +} diff --git a/tests/baselines/reference/unreachableJavascriptUnchecked.types b/tests/baselines/reference/unreachableJavascriptUnchecked.types new file mode 100644 index 0000000000000..266a9038875cb --- /dev/null +++ b/tests/baselines/reference/unreachableJavascriptUnchecked.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/unreachable.js === +function unreachable() { +>unreachable : () => 1 | 2 + + return 1; +>1 : 1 + + return 2; +>2 : 2 +} diff --git a/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts b/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts index 3433adc17d54e..7659350d489f9 100644 --- a/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts +++ b/tests/cases/compiler/jsFileCompilationBindDuplicateIdentifier.ts @@ -1,4 +1,5 @@ // @allowJs: true +// @checkJs: true // @noEmit: true // @filename: a.js var a = 10; diff --git a/tests/cases/compiler/jsFileCompilationBindErrors.ts b/tests/cases/compiler/jsFileCompilationBindErrors.ts index 37bdbc62916a0..7c43b329a4740 100644 --- a/tests/cases/compiler/jsFileCompilationBindErrors.ts +++ b/tests/cases/compiler/jsFileCompilationBindErrors.ts @@ -1,4 +1,5 @@ // @allowJs: true +// @checkJs: true // @noEmit: true // @filename: a.js let C = "sss"; diff --git a/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts b/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts index 32a9e77fcc765..e7816f92ad109 100644 --- a/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts +++ b/tests/cases/compiler/jsFileCompilationBindMultipleDefaultExports.ts @@ -1,4 +1,5 @@ // @allowJs: true +// @checkJs: true // @noEmit: true // @filename: a.js // @target: es6 diff --git a/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts b/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts index b95f85c21398c..e92732313163a 100644 --- a/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts +++ b/tests/cases/compiler/jsFileCompilationBindReachabilityErrors.ts @@ -1,4 +1,5 @@ // @allowJs: true +// @checkJs: true // @noEmit: true // @filename: a.js // @noFallthroughCasesInSwitch: true diff --git a/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts b/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts index 30b43b1990e32..527927be6e6f5 100644 --- a/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts +++ b/tests/cases/compiler/jsFileCompilationBindStrictModeErrors.ts @@ -1,4 +1,5 @@ // @allowJs: true +// @checkJs: true // @noEmit: true // @filename: a.js // @target: es6 diff --git a/tests/cases/compiler/unreachableJavascriptChecked.ts b/tests/cases/compiler/unreachableJavascriptChecked.ts new file mode 100644 index 0000000000000..4db98c4c8c4e1 --- /dev/null +++ b/tests/cases/compiler/unreachableJavascriptChecked.ts @@ -0,0 +1,8 @@ +// @Filename: unreachable.js +// @allowJs: true +// @checkJs: true +// @outDir: out +function unreachable() { + return 1; + return 2; +} \ No newline at end of file diff --git a/tests/cases/compiler/unreachableJavascriptUnchecked.ts b/tests/cases/compiler/unreachableJavascriptUnchecked.ts new file mode 100644 index 0000000000000..d5b1f45e28204 --- /dev/null +++ b/tests/cases/compiler/unreachableJavascriptUnchecked.ts @@ -0,0 +1,8 @@ +// @Filename: unreachable.js +// @allowJs: true +// @checkJs: false +// @outDir: out +function unreachable() { + return 1; + return 2; +} \ No newline at end of file