mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Merge pull request #16227 from amcasey/release-2.3
Port checkJs fix from master
This commit is contained in:
commit
a952c19368
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
2
lib/tsserverlibrary.d.ts
vendored
2
lib/tsserverlibrary.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
2
lib/typescript.d.ts
vendored
2
lib/typescript.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
2
lib/typescriptServices.d.ts
vendored
2
lib/typescriptServices.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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": [
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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.
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2652: Merged declaration 'a' cannot include a default export declaration. Consider adding a separate 'export default a' declaration instead.
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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.
|
||||
}
|
||||
11
tests/baselines/reference/unreachableJavascriptChecked.js
Normal file
11
tests/baselines/reference/unreachableJavascriptChecked.js
Normal file
@ -0,0 +1,11 @@
|
||||
//// [unreachable.js]
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
//// [unreachable.js]
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
11
tests/baselines/reference/unreachableJavascriptUnchecked.js
Normal file
11
tests/baselines/reference/unreachableJavascriptUnchecked.js
Normal file
@ -0,0 +1,11 @@
|
||||
//// [unreachable.js]
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
//// [unreachable.js]
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
=== tests/cases/compiler/unreachable.js ===
|
||||
function unreachable() {
|
||||
>unreachable : Symbol(unreachable, Decl(unreachable.js, 0, 0))
|
||||
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/unreachable.js ===
|
||||
function unreachable() {
|
||||
>unreachable : () => 1 | 2
|
||||
|
||||
return 1;
|
||||
>1 : 1
|
||||
|
||||
return 2;
|
||||
>2 : 2
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
var a = 10;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
let C = "sss";
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
// @target: es6
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
// @noFallthroughCasesInSwitch: true
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @noEmit: true
|
||||
// @filename: a.js
|
||||
// @target: es6
|
||||
|
||||
8
tests/cases/compiler/unreachableJavascriptChecked.ts
Normal file
8
tests/cases/compiler/unreachableJavascriptChecked.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// @Filename: unreachable.js
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @outDir: out
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
8
tests/cases/compiler/unreachableJavascriptUnchecked.ts
Normal file
8
tests/cases/compiler/unreachableJavascriptUnchecked.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// @Filename: unreachable.js
|
||||
// @allowJs: true
|
||||
// @checkJs: false
|
||||
// @outDir: out
|
||||
function unreachable() {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user