From 8118bec3d422e81d2a2612e2f158feb01686f35a Mon Sep 17 00:00:00 2001 From: Ben Lichtman Date: Tue, 27 Aug 2019 09:35:35 -0700 Subject: [PATCH] Update LKG --- lib/tsc.js | 43 ++++++++++------------- lib/tsserver.js | 68 ++++++++++++++++++------------------- lib/tsserverlibrary.d.ts | 4 ++- lib/tsserverlibrary.js | 68 ++++++++++++++++++------------------- lib/typescript.d.ts | 4 ++- lib/typescript.js | 68 ++++++++++++++++++------------------- lib/typescriptServices.d.ts | 4 ++- lib/typescriptServices.js | 68 ++++++++++++++++++------------------- lib/typingsInstaller.js | 56 ++++++++++++++---------------- 9 files changed, 188 insertions(+), 195 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 007604803080e..9e48e7c38c5bf 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook var ts; (function (ts) { ts.versionMajorMinor = "3.6"; - ts.version = ts.versionMajorMinor + ".1-rc"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { ts.emptyArray = []; @@ -38588,8 +38588,7 @@ var ts; var visited; var bivariant = false; var propagationType; - var inferenceMatch = false; - var inferenceIncomplete = false; + var inferencePriority = 256; var allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); function inferFromTypes(source, target) { @@ -38679,7 +38678,7 @@ var ts; clearCachedInferences(inferences); } } - inferenceMatch = true; + inferencePriority = Math.min(inferencePriority, priority); return; } else { @@ -38757,21 +38756,15 @@ var ts; var key = source.id + "," + target.id; var status = visited && visited.get(key); if (status !== undefined) { - if (status & 1) - inferenceMatch = true; - if (status & 2) - inferenceIncomplete = true; + inferencePriority = Math.min(inferencePriority, status); return; } - (visited || (visited = ts.createMap())).set(key, 0); - var saveInferenceMatch = inferenceMatch; - var saveInferenceIncomplete = inferenceIncomplete; - inferenceMatch = false; - inferenceIncomplete = false; + (visited || (visited = ts.createMap())).set(key, -1); + var saveInferencePriority = inferencePriority; + inferencePriority = 256; action(source, target); - visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); - inferenceMatch = inferenceMatch || saveInferenceMatch; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } function inferFromMatchingType(source, targets, matches) { var matched = false; @@ -38841,8 +38834,7 @@ var ts; var nakedTypeVariable = void 0; var sources = source.flags & 1048576 ? source.types : [source]; var matched_1 = new Array(sources.length); - var saveInferenceIncomplete = inferenceIncomplete; - inferenceIncomplete = false; + var inferenceCircularity = false; for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) { var t = targets_3[_i]; if (getInferenceInfoForType(t)) { @@ -38851,18 +38843,17 @@ var ts; } else { for (var i = 0; i < sources.length; i++) { - var saveInferenceMatch = inferenceMatch; - inferenceMatch = false; + var saveInferencePriority = inferencePriority; + inferencePriority = 256; inferFromTypes(sources[i], t); - if (inferenceMatch) + if (inferencePriority === priority) matched_1[i] = true; - inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceCircularity = inferenceCircularity || inferencePriority === -1; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } } } - var inferenceComplete = !inferenceIncomplete; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; - if (typeVariableCount === 1 && inferenceComplete) { + if (typeVariableCount === 1 && !inferenceCircularity) { var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; }); if (unmatched.length) { inferFromTypes(getUnionType(unmatched), nakedTypeVariable); @@ -38940,7 +38931,7 @@ var ts; var symbol = isNonConstructorObject ? target.symbol : undefined; if (symbol) { if (ts.contains(symbolStack, symbol)) { - inferenceIncomplete = true; + inferencePriority = -1; return; } (symbolStack || (symbolStack = [])).push(symbol); diff --git a/lib/tsserver.js b/lib/tsserver.js index e38818879d626..efc90d6af25ee 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -94,7 +94,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1-rc"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ @@ -3815,7 +3815,9 @@ var ts; InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof"; InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints"; InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict"; + InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue"; InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination"; + InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity"; })(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); /* @internal */ var InferenceFlags; @@ -46196,8 +46198,7 @@ var ts; var visited; var bivariant = false; var propagationType; - var inferenceMatch = false; - var inferenceIncomplete = false; + var inferencePriority = 256 /* MaxValue */; var allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); function inferFromTypes(source, target) { @@ -46313,7 +46314,7 @@ var ts; clearCachedInferences(inferences); } } - inferenceMatch = true; + inferencePriority = Math.min(inferencePriority, priority); return; } else { @@ -46406,21 +46407,15 @@ var ts; var key = source.id + "," + target.id; var status = visited && visited.get(key); if (status !== undefined) { - if (status & 1) - inferenceMatch = true; - if (status & 2) - inferenceIncomplete = true; + inferencePriority = Math.min(inferencePriority, status); return; } - (visited || (visited = ts.createMap())).set(key, 0); - var saveInferenceMatch = inferenceMatch; - var saveInferenceIncomplete = inferenceIncomplete; - inferenceMatch = false; - inferenceIncomplete = false; + (visited || (visited = ts.createMap())).set(key, -1 /* Circularity */); + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; action(source, target); - visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); - inferenceMatch = inferenceMatch || saveInferenceMatch; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } function inferFromMatchingType(source, targets, matches) { var matched = false; @@ -46490,10 +46485,11 @@ var ts; var nakedTypeVariable = void 0; var sources = source.flags & 1048576 /* Union */ ? source.types : [source]; var matched_1 = new Array(sources.length); - var saveInferenceIncomplete = inferenceIncomplete; - inferenceIncomplete = false; + var inferenceCircularity = false; // First infer to types that are not naked type variables. For each source type we - // track whether inferences were made from that particular type to some target. + // track whether inferences were made from that particular type to some target with + // equal priority (i.e. of equal quality) to what we would infer for a naked type + // parameter. for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) { var t = targets_3[_i]; if (getInferenceInfoForType(t)) { @@ -46502,21 +46498,21 @@ var ts; } else { for (var i = 0; i < sources.length; i++) { - var saveInferenceMatch = inferenceMatch; - inferenceMatch = false; + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; inferFromTypes(sources[i], t); - if (inferenceMatch) + if (inferencePriority === priority) matched_1[i] = true; - inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } } } - var inferenceComplete = !inferenceIncomplete; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; - // If the target has a single naked type variable and inference completed (meaning we - // explored the types fully), create a union of the source types from which no inferences - // have been made so far and infer from that union to the naked type variable. - if (typeVariableCount === 1 && inferenceComplete) { + // If the target has a single naked type variable and no inference circularities were + // encountered above (meaning we explored the types fully), create a union of the source + // types from which no inferences have been made so far and infer from that union to the + // naked type variable. + if (typeVariableCount === 1 && !inferenceCircularity) { var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; }); if (unmatched.length) { inferFromTypes(getUnionType(unmatched), nakedTypeVariable); @@ -46620,7 +46616,7 @@ var ts; var symbol = isNonConstructorObject ? target.symbol : undefined; if (symbol) { if (ts.contains(symbolStack, symbol)) { - inferenceIncomplete = true; + inferencePriority = -1 /* Circularity */; return; } (symbolStack || (symbolStack = [])).push(symbol); @@ -101202,14 +101198,18 @@ var ts; if (!match) { return false; } + // Limiting classification to exactly the elements and attributes + // defined in `ts.commentPragmas` would be excessive, but we can avoid + // some obvious false positives (e.g. in XML-like doc comments) by + // checking the element name. + if (!match[3] || !(match[3] in ts.commentPragmas)) { + return false; + } var pos = start; pushCommentRange(pos, match[1].length); // /// pos += match[1].length; pushClassification(pos, match[2].length, 10 /* punctuation */); // < pos += match[2].length; - if (!match[3]) { - return true; - } pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name pos += match[3].length; var attrText = match[4]; @@ -111865,7 +111865,7 @@ var ts; // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; // if jsx is specified then treat file as .tsx - var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); + var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217 if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index c877d7d2d9a72..768399664828e 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -2441,7 +2441,9 @@ declare namespace ts { LiteralKeyof = 32, NoConstraints = 64, AlwaysStrict = 128, - PriorityImpliesCombination = 56 + MaxValue = 256, + PriorityImpliesCombination = 56, + Circularity = -1 } /** @deprecated Use FileExtensionInfo instead. */ export type JsFileExtensionInfo = FileExtensionInfo; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index d5edd1e044f72..252b62b131d4f 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -93,7 +93,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1-rc"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ @@ -3814,7 +3814,9 @@ var ts; InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof"; InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints"; InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict"; + InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue"; InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination"; + InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity"; })(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); /* @internal */ var InferenceFlags; @@ -46195,8 +46197,7 @@ var ts; var visited; var bivariant = false; var propagationType; - var inferenceMatch = false; - var inferenceIncomplete = false; + var inferencePriority = 256 /* MaxValue */; var allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); function inferFromTypes(source, target) { @@ -46312,7 +46313,7 @@ var ts; clearCachedInferences(inferences); } } - inferenceMatch = true; + inferencePriority = Math.min(inferencePriority, priority); return; } else { @@ -46405,21 +46406,15 @@ var ts; var key = source.id + "," + target.id; var status = visited && visited.get(key); if (status !== undefined) { - if (status & 1) - inferenceMatch = true; - if (status & 2) - inferenceIncomplete = true; + inferencePriority = Math.min(inferencePriority, status); return; } - (visited || (visited = ts.createMap())).set(key, 0); - var saveInferenceMatch = inferenceMatch; - var saveInferenceIncomplete = inferenceIncomplete; - inferenceMatch = false; - inferenceIncomplete = false; + (visited || (visited = ts.createMap())).set(key, -1 /* Circularity */); + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; action(source, target); - visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); - inferenceMatch = inferenceMatch || saveInferenceMatch; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } function inferFromMatchingType(source, targets, matches) { var matched = false; @@ -46489,10 +46484,11 @@ var ts; var nakedTypeVariable = void 0; var sources = source.flags & 1048576 /* Union */ ? source.types : [source]; var matched_1 = new Array(sources.length); - var saveInferenceIncomplete = inferenceIncomplete; - inferenceIncomplete = false; + var inferenceCircularity = false; // First infer to types that are not naked type variables. For each source type we - // track whether inferences were made from that particular type to some target. + // track whether inferences were made from that particular type to some target with + // equal priority (i.e. of equal quality) to what we would infer for a naked type + // parameter. for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) { var t = targets_3[_i]; if (getInferenceInfoForType(t)) { @@ -46501,21 +46497,21 @@ var ts; } else { for (var i = 0; i < sources.length; i++) { - var saveInferenceMatch = inferenceMatch; - inferenceMatch = false; + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; inferFromTypes(sources[i], t); - if (inferenceMatch) + if (inferencePriority === priority) matched_1[i] = true; - inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } } } - var inferenceComplete = !inferenceIncomplete; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; - // If the target has a single naked type variable and inference completed (meaning we - // explored the types fully), create a union of the source types from which no inferences - // have been made so far and infer from that union to the naked type variable. - if (typeVariableCount === 1 && inferenceComplete) { + // If the target has a single naked type variable and no inference circularities were + // encountered above (meaning we explored the types fully), create a union of the source + // types from which no inferences have been made so far and infer from that union to the + // naked type variable. + if (typeVariableCount === 1 && !inferenceCircularity) { var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; }); if (unmatched.length) { inferFromTypes(getUnionType(unmatched), nakedTypeVariable); @@ -46619,7 +46615,7 @@ var ts; var symbol = isNonConstructorObject ? target.symbol : undefined; if (symbol) { if (ts.contains(symbolStack, symbol)) { - inferenceIncomplete = true; + inferencePriority = -1 /* Circularity */; return; } (symbolStack || (symbolStack = [])).push(symbol); @@ -101565,14 +101561,18 @@ var ts; if (!match) { return false; } + // Limiting classification to exactly the elements and attributes + // defined in `ts.commentPragmas` would be excessive, but we can avoid + // some obvious false positives (e.g. in XML-like doc comments) by + // checking the element name. + if (!match[3] || !(match[3] in ts.commentPragmas)) { + return false; + } var pos = start; pushCommentRange(pos, match[1].length); // /// pos += match[1].length; pushClassification(pos, match[2].length, 10 /* punctuation */); // < pos += match[2].length; - if (!match[3]) { - return true; - } pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name pos += match[3].length; var attrText = match[4]; @@ -112228,7 +112228,7 @@ var ts; // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; // if jsx is specified then treat file as .tsx - var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); + var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217 if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 4c28abcbbc3a3..811f3b3507c53 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -2441,7 +2441,9 @@ declare namespace ts { LiteralKeyof = 32, NoConstraints = 64, AlwaysStrict = 128, - PriorityImpliesCombination = 56 + MaxValue = 256, + PriorityImpliesCombination = 56, + Circularity = -1 } /** @deprecated Use FileExtensionInfo instead. */ export type JsFileExtensionInfo = FileExtensionInfo; diff --git a/lib/typescript.js b/lib/typescript.js index 141256c56e8cf..84f0e442ec823 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -82,7 +82,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1-rc"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ @@ -3803,7 +3803,9 @@ var ts; InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof"; InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints"; InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict"; + InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue"; InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination"; + InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity"; })(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); /* @internal */ var InferenceFlags; @@ -46184,8 +46186,7 @@ var ts; var visited; var bivariant = false; var propagationType; - var inferenceMatch = false; - var inferenceIncomplete = false; + var inferencePriority = 256 /* MaxValue */; var allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); function inferFromTypes(source, target) { @@ -46301,7 +46302,7 @@ var ts; clearCachedInferences(inferences); } } - inferenceMatch = true; + inferencePriority = Math.min(inferencePriority, priority); return; } else { @@ -46394,21 +46395,15 @@ var ts; var key = source.id + "," + target.id; var status = visited && visited.get(key); if (status !== undefined) { - if (status & 1) - inferenceMatch = true; - if (status & 2) - inferenceIncomplete = true; + inferencePriority = Math.min(inferencePriority, status); return; } - (visited || (visited = ts.createMap())).set(key, 0); - var saveInferenceMatch = inferenceMatch; - var saveInferenceIncomplete = inferenceIncomplete; - inferenceMatch = false; - inferenceIncomplete = false; + (visited || (visited = ts.createMap())).set(key, -1 /* Circularity */); + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; action(source, target); - visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); - inferenceMatch = inferenceMatch || saveInferenceMatch; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } function inferFromMatchingType(source, targets, matches) { var matched = false; @@ -46478,10 +46473,11 @@ var ts; var nakedTypeVariable = void 0; var sources = source.flags & 1048576 /* Union */ ? source.types : [source]; var matched_1 = new Array(sources.length); - var saveInferenceIncomplete = inferenceIncomplete; - inferenceIncomplete = false; + var inferenceCircularity = false; // First infer to types that are not naked type variables. For each source type we - // track whether inferences were made from that particular type to some target. + // track whether inferences were made from that particular type to some target with + // equal priority (i.e. of equal quality) to what we would infer for a naked type + // parameter. for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) { var t = targets_3[_i]; if (getInferenceInfoForType(t)) { @@ -46490,21 +46486,21 @@ var ts; } else { for (var i = 0; i < sources.length; i++) { - var saveInferenceMatch = inferenceMatch; - inferenceMatch = false; + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; inferFromTypes(sources[i], t); - if (inferenceMatch) + if (inferencePriority === priority) matched_1[i] = true; - inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } } } - var inferenceComplete = !inferenceIncomplete; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; - // If the target has a single naked type variable and inference completed (meaning we - // explored the types fully), create a union of the source types from which no inferences - // have been made so far and infer from that union to the naked type variable. - if (typeVariableCount === 1 && inferenceComplete) { + // If the target has a single naked type variable and no inference circularities were + // encountered above (meaning we explored the types fully), create a union of the source + // types from which no inferences have been made so far and infer from that union to the + // naked type variable. + if (typeVariableCount === 1 && !inferenceCircularity) { var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; }); if (unmatched.length) { inferFromTypes(getUnionType(unmatched), nakedTypeVariable); @@ -46608,7 +46604,7 @@ var ts; var symbol = isNonConstructorObject ? target.symbol : undefined; if (symbol) { if (ts.contains(symbolStack, symbol)) { - inferenceIncomplete = true; + inferencePriority = -1 /* Circularity */; return; } (symbolStack || (symbolStack = [])).push(symbol); @@ -101554,14 +101550,18 @@ var ts; if (!match) { return false; } + // Limiting classification to exactly the elements and attributes + // defined in `ts.commentPragmas` would be excessive, but we can avoid + // some obvious false positives (e.g. in XML-like doc comments) by + // checking the element name. + if (!match[3] || !(match[3] in ts.commentPragmas)) { + return false; + } var pos = start; pushCommentRange(pos, match[1].length); // /// pos += match[1].length; pushClassification(pos, match[2].length, 10 /* punctuation */); // < pos += match[2].length; - if (!match[3]) { - return true; - } pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name pos += match[3].length; var attrText = match[4]; @@ -112217,7 +112217,7 @@ var ts; // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; // if jsx is specified then treat file as .tsx - var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); + var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217 if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 1bd402fcfab39..828a2d4732644 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -2441,7 +2441,9 @@ declare namespace ts { LiteralKeyof = 32, NoConstraints = 64, AlwaysStrict = 128, - PriorityImpliesCombination = 56 + MaxValue = 256, + PriorityImpliesCombination = 56, + Circularity = -1 } /** @deprecated Use FileExtensionInfo instead. */ export type JsFileExtensionInfo = FileExtensionInfo; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 3c70781076b5b..b10cbbcec4f91 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -82,7 +82,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1-rc"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ @@ -3803,7 +3803,9 @@ var ts; InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof"; InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints"; InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict"; + InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue"; InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination"; + InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity"; })(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); /* @internal */ var InferenceFlags; @@ -46184,8 +46186,7 @@ var ts; var visited; var bivariant = false; var propagationType; - var inferenceMatch = false; - var inferenceIncomplete = false; + var inferencePriority = 256 /* MaxValue */; var allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); function inferFromTypes(source, target) { @@ -46301,7 +46302,7 @@ var ts; clearCachedInferences(inferences); } } - inferenceMatch = true; + inferencePriority = Math.min(inferencePriority, priority); return; } else { @@ -46394,21 +46395,15 @@ var ts; var key = source.id + "," + target.id; var status = visited && visited.get(key); if (status !== undefined) { - if (status & 1) - inferenceMatch = true; - if (status & 2) - inferenceIncomplete = true; + inferencePriority = Math.min(inferencePriority, status); return; } - (visited || (visited = ts.createMap())).set(key, 0); - var saveInferenceMatch = inferenceMatch; - var saveInferenceIncomplete = inferenceIncomplete; - inferenceMatch = false; - inferenceIncomplete = false; + (visited || (visited = ts.createMap())).set(key, -1 /* Circularity */); + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; action(source, target); - visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); - inferenceMatch = inferenceMatch || saveInferenceMatch; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } function inferFromMatchingType(source, targets, matches) { var matched = false; @@ -46478,10 +46473,11 @@ var ts; var nakedTypeVariable = void 0; var sources = source.flags & 1048576 /* Union */ ? source.types : [source]; var matched_1 = new Array(sources.length); - var saveInferenceIncomplete = inferenceIncomplete; - inferenceIncomplete = false; + var inferenceCircularity = false; // First infer to types that are not naked type variables. For each source type we - // track whether inferences were made from that particular type to some target. + // track whether inferences were made from that particular type to some target with + // equal priority (i.e. of equal quality) to what we would infer for a naked type + // parameter. for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) { var t = targets_3[_i]; if (getInferenceInfoForType(t)) { @@ -46490,21 +46486,21 @@ var ts; } else { for (var i = 0; i < sources.length; i++) { - var saveInferenceMatch = inferenceMatch; - inferenceMatch = false; + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; inferFromTypes(sources[i], t); - if (inferenceMatch) + if (inferencePriority === priority) matched_1[i] = true; - inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } } } - var inferenceComplete = !inferenceIncomplete; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; - // If the target has a single naked type variable and inference completed (meaning we - // explored the types fully), create a union of the source types from which no inferences - // have been made so far and infer from that union to the naked type variable. - if (typeVariableCount === 1 && inferenceComplete) { + // If the target has a single naked type variable and no inference circularities were + // encountered above (meaning we explored the types fully), create a union of the source + // types from which no inferences have been made so far and infer from that union to the + // naked type variable. + if (typeVariableCount === 1 && !inferenceCircularity) { var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; }); if (unmatched.length) { inferFromTypes(getUnionType(unmatched), nakedTypeVariable); @@ -46608,7 +46604,7 @@ var ts; var symbol = isNonConstructorObject ? target.symbol : undefined; if (symbol) { if (ts.contains(symbolStack, symbol)) { - inferenceIncomplete = true; + inferencePriority = -1 /* Circularity */; return; } (symbolStack || (symbolStack = [])).push(symbol); @@ -101554,14 +101550,18 @@ var ts; if (!match) { return false; } + // Limiting classification to exactly the elements and attributes + // defined in `ts.commentPragmas` would be excessive, but we can avoid + // some obvious false positives (e.g. in XML-like doc comments) by + // checking the element name. + if (!match[3] || !(match[3] in ts.commentPragmas)) { + return false; + } var pos = start; pushCommentRange(pos, match[1].length); // /// pos += match[1].length; pushClassification(pos, match[2].length, 10 /* punctuation */); // < pos += match[2].length; - if (!match[3]) { - return true; - } pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name pos += match[3].length; var attrText = match[4]; @@ -112217,7 +112217,7 @@ var ts; // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; // if jsx is specified then treat file as .tsx - var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts"); + var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217 if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index e84a3c1650874..2de93db4c152e 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -83,7 +83,7 @@ var ts; // If changing the text in this section, be sure to test `configureNightly` too. ts.versionMajorMinor = "3.6"; /** The version of the TypeScript compiler release */ - ts.version = ts.versionMajorMinor + ".1-rc"; + ts.version = ts.versionMajorMinor + ".2"; })(ts || (ts = {})); (function (ts) { /* @internal */ @@ -3804,7 +3804,9 @@ var ts; InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof"; InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints"; InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict"; + InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue"; InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination"; + InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity"; })(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {})); /* @internal */ var InferenceFlags; @@ -46185,8 +46187,7 @@ var ts; var visited; var bivariant = false; var propagationType; - var inferenceMatch = false; - var inferenceIncomplete = false; + var inferencePriority = 256 /* MaxValue */; var allowComplexConstraintInference = true; inferFromTypes(originalSource, originalTarget); function inferFromTypes(source, target) { @@ -46302,7 +46303,7 @@ var ts; clearCachedInferences(inferences); } } - inferenceMatch = true; + inferencePriority = Math.min(inferencePriority, priority); return; } else { @@ -46395,21 +46396,15 @@ var ts; var key = source.id + "," + target.id; var status = visited && visited.get(key); if (status !== undefined) { - if (status & 1) - inferenceMatch = true; - if (status & 2) - inferenceIncomplete = true; + inferencePriority = Math.min(inferencePriority, status); return; } - (visited || (visited = ts.createMap())).set(key, 0); - var saveInferenceMatch = inferenceMatch; - var saveInferenceIncomplete = inferenceIncomplete; - inferenceMatch = false; - inferenceIncomplete = false; + (visited || (visited = ts.createMap())).set(key, -1 /* Circularity */); + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; action(source, target); - visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0)); - inferenceMatch = inferenceMatch || saveInferenceMatch; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; + visited.set(key, inferencePriority); + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } function inferFromMatchingType(source, targets, matches) { var matched = false; @@ -46479,10 +46474,11 @@ var ts; var nakedTypeVariable = void 0; var sources = source.flags & 1048576 /* Union */ ? source.types : [source]; var matched_1 = new Array(sources.length); - var saveInferenceIncomplete = inferenceIncomplete; - inferenceIncomplete = false; + var inferenceCircularity = false; // First infer to types that are not naked type variables. For each source type we - // track whether inferences were made from that particular type to some target. + // track whether inferences were made from that particular type to some target with + // equal priority (i.e. of equal quality) to what we would infer for a naked type + // parameter. for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) { var t = targets_3[_i]; if (getInferenceInfoForType(t)) { @@ -46491,21 +46487,21 @@ var ts; } else { for (var i = 0; i < sources.length; i++) { - var saveInferenceMatch = inferenceMatch; - inferenceMatch = false; + var saveInferencePriority = inferencePriority; + inferencePriority = 256 /* MaxValue */; inferFromTypes(sources[i], t); - if (inferenceMatch) + if (inferencePriority === priority) matched_1[i] = true; - inferenceMatch = inferenceMatch || saveInferenceMatch; + inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */; + inferencePriority = Math.min(inferencePriority, saveInferencePriority); } } } - var inferenceComplete = !inferenceIncomplete; - inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete; - // If the target has a single naked type variable and inference completed (meaning we - // explored the types fully), create a union of the source types from which no inferences - // have been made so far and infer from that union to the naked type variable. - if (typeVariableCount === 1 && inferenceComplete) { + // If the target has a single naked type variable and no inference circularities were + // encountered above (meaning we explored the types fully), create a union of the source + // types from which no inferences have been made so far and infer from that union to the + // naked type variable. + if (typeVariableCount === 1 && !inferenceCircularity) { var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; }); if (unmatched.length) { inferFromTypes(getUnionType(unmatched), nakedTypeVariable); @@ -46609,7 +46605,7 @@ var ts; var symbol = isNonConstructorObject ? target.symbol : undefined; if (symbol) { if (ts.contains(symbolStack, symbol)) { - inferenceIncomplete = true; + inferencePriority = -1 /* Circularity */; return; } (symbolStack || (symbolStack = [])).push(symbol);