diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b5d8793519a..a2b8b5a2a7a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -12366,7 +12366,7 @@ namespace ts { seen = c === node; } }); - // We may be here because of some extra junk between overloads that could not be parsed into a valid node. + // We may be here because of some extra nodes between overloads that could not be parsed into a valid node. // In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here. if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index e5b85a7391e..9f68809c389 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -710,16 +710,19 @@ namespace ts { else { const compilerOptions = extend(options, defaultInitCompilerOptions); const configurations: any = { - compilerOptions: serializeCompilerOptions(compilerOptions) + compilerOptions: serializeCompilerOptions(compilerOptions) }; if (fileNames && fileNames.length) { // only set the files property if we have at least one file configurations.files = fileNames; } - else { - configurations.exclude = ["node_modules"]; - } + else { + configurations.exclude = ["node_modules"]; + if (compilerOptions.outDir) { + configurations.exclude.push(compilerOptions.outDir); + } + } sys.writeFile(file, JSON.stringify(configurations, undefined, 4)); reportDiagnostic(createCompilerDiagnostic(Diagnostics.Successfully_created_a_tsconfig_json_file), /* compilerHost */ undefined); diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index 3a669753323..b8207570ea2 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -469,7 +469,7 @@ declare namespace ts.server.protocol { placeOpenBraceOnNewLineForControlBlocks?: boolean; /** Index operator */ - [key: string] : string | number | boolean; + [key: string]: string | number | boolean; } /** diff --git a/src/services/services.ts b/src/services/services.ts index 38daea8d608..65a6bd1362c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2838,7 +2838,7 @@ namespace ts { if (oldSourceFile) { // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to - // address the following 'race'. Specifically, say we have the following: + // address the following race-condition. Specifically, say we have the following: // // LS1 // \ diff --git a/tests/baselines/reference/VariableDeclaration12_es6.js b/tests/baselines/reference/VariableDeclaration12_es6.js new file mode 100644 index 00000000000..1e7d6d4b363 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration12_es6.js @@ -0,0 +1,7 @@ +//// [VariableDeclaration12_es6.ts] + +let +x + +//// [VariableDeclaration12_es6.js] +let x; diff --git a/tests/baselines/reference/VariableDeclaration12_es6.symbols b/tests/baselines/reference/VariableDeclaration12_es6.symbols new file mode 100644 index 00000000000..a2f324502dd --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration12_es6.symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts === + +let +x +>x : Symbol(x, Decl(VariableDeclaration12_es6.ts, 1, 3)) + diff --git a/tests/baselines/reference/VariableDeclaration12_es6.types b/tests/baselines/reference/VariableDeclaration12_es6.types new file mode 100644 index 00000000000..14f23f88a7a --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration12_es6.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts === + +let +x +>x : any + diff --git a/tests/baselines/reference/VariableDeclaration13_es6.errors.txt b/tests/baselines/reference/VariableDeclaration13_es6.errors.txt new file mode 100644 index 00000000000..a022a4ad52b --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration13_es6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,5): error TS1181: Array element destructuring pattern expected. +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,6): error TS1005: ',' expected. +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,8): error TS1134: Variable declaration expected. +tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,10): error TS1134: Variable declaration expected. + + +==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts (4 errors) ==== + + // An ExpressionStatement cannot start with the two token sequence `let [` because + // that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. + var let: any; + let[0] = 100; + ~ +!!! error TS1181: Array element destructuring pattern expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1134: Variable declaration expected. + ~~~ +!!! error TS1134: Variable declaration expected. \ No newline at end of file diff --git a/tests/baselines/reference/VariableDeclaration13_es6.js b/tests/baselines/reference/VariableDeclaration13_es6.js new file mode 100644 index 00000000000..4ec04b18c3a --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration13_es6.js @@ -0,0 +1,13 @@ +//// [VariableDeclaration13_es6.ts] + +// An ExpressionStatement cannot start with the two token sequence `let [` because +// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. +var let: any; +let[0] = 100; + +//// [VariableDeclaration13_es6.js] +// An ExpressionStatement cannot start with the two token sequence `let [` because +// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. +var let; +let [] = 0; +100; diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.js b/tests/baselines/reference/letIdentifierInElementAccess01.js new file mode 100644 index 00000000000..5e5e857479c --- /dev/null +++ b/tests/baselines/reference/letIdentifierInElementAccess01.js @@ -0,0 +1,7 @@ +//// [letIdentifierInElementAccess01.ts] +var let: any = {}; +(let[0] = 100); + +//// [letIdentifierInElementAccess01.js] +var let = {}; +(let[0] = 100); diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.symbols b/tests/baselines/reference/letIdentifierInElementAccess01.symbols new file mode 100644 index 00000000000..a655b5703b0 --- /dev/null +++ b/tests/baselines/reference/letIdentifierInElementAccess01.symbols @@ -0,0 +1,7 @@ +=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts === +var let: any = {}; +>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3)) + +(let[0] = 100); +>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3)) + diff --git a/tests/baselines/reference/letIdentifierInElementAccess01.types b/tests/baselines/reference/letIdentifierInElementAccess01.types new file mode 100644 index 00000000000..187fd7e221c --- /dev/null +++ b/tests/baselines/reference/letIdentifierInElementAccess01.types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts === +var let: any = {}; +>let : any +>{} : {} + +(let[0] = 100); +>(let[0] = 100) : number +>let[0] = 100 : number +>let[0] : any +>let : any +>0 : number +>100 : number + diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts new file mode 100644 index 00000000000..f9839cf8502 --- /dev/null +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts @@ -0,0 +1,4 @@ +// @target:es6 + +let +x \ No newline at end of file diff --git a/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts new file mode 100644 index 00000000000..0f20b02c01c --- /dev/null +++ b/tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts @@ -0,0 +1,6 @@ +// @target:es6 + +// An ExpressionStatement cannot start with the two token sequence `let [` because +// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern. +var let: any; +let[0] = 100; \ No newline at end of file diff --git a/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts b/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts new file mode 100644 index 00000000000..f0f71dc6ceb --- /dev/null +++ b/tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts @@ -0,0 +1,2 @@ +var let: any = {}; +(let[0] = 100); \ No newline at end of file