Skip to content

Commit 8118bec

Browse files
author
Ben Lichtman
committed
Update LKG
1 parent f28bdb4 commit 8118bec

9 files changed

+188
-195
lines changed

lib/tsc.js

+17-26
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
6767
var ts;
6868
(function (ts) {
6969
ts.versionMajorMinor = "3.6";
70-
ts.version = ts.versionMajorMinor + ".1-rc";
70+
ts.version = ts.versionMajorMinor + ".2";
7171
})(ts || (ts = {}));
7272
(function (ts) {
7373
ts.emptyArray = [];
@@ -38588,8 +38588,7 @@ var ts;
3858838588
var visited;
3858938589
var bivariant = false;
3859038590
var propagationType;
38591-
var inferenceMatch = false;
38592-
var inferenceIncomplete = false;
38591+
var inferencePriority = 256;
3859338592
var allowComplexConstraintInference = true;
3859438593
inferFromTypes(originalSource, originalTarget);
3859538594
function inferFromTypes(source, target) {
@@ -38679,7 +38678,7 @@ var ts;
3867938678
clearCachedInferences(inferences);
3868038679
}
3868138680
}
38682-
inferenceMatch = true;
38681+
inferencePriority = Math.min(inferencePriority, priority);
3868338682
return;
3868438683
}
3868538684
else {
@@ -38757,21 +38756,15 @@ var ts;
3875738756
var key = source.id + "," + target.id;
3875838757
var status = visited && visited.get(key);
3875938758
if (status !== undefined) {
38760-
if (status & 1)
38761-
inferenceMatch = true;
38762-
if (status & 2)
38763-
inferenceIncomplete = true;
38759+
inferencePriority = Math.min(inferencePriority, status);
3876438760
return;
3876538761
}
38766-
(visited || (visited = ts.createMap())).set(key, 0);
38767-
var saveInferenceMatch = inferenceMatch;
38768-
var saveInferenceIncomplete = inferenceIncomplete;
38769-
inferenceMatch = false;
38770-
inferenceIncomplete = false;
38762+
(visited || (visited = ts.createMap())).set(key, -1);
38763+
var saveInferencePriority = inferencePriority;
38764+
inferencePriority = 256;
3877138765
action(source, target);
38772-
visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
38773-
inferenceMatch = inferenceMatch || saveInferenceMatch;
38774-
inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
38766+
visited.set(key, inferencePriority);
38767+
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
3877538768
}
3877638769
function inferFromMatchingType(source, targets, matches) {
3877738770
var matched = false;
@@ -38841,8 +38834,7 @@ var ts;
3884138834
var nakedTypeVariable = void 0;
3884238835
var sources = source.flags & 1048576 ? source.types : [source];
3884338836
var matched_1 = new Array(sources.length);
38844-
var saveInferenceIncomplete = inferenceIncomplete;
38845-
inferenceIncomplete = false;
38837+
var inferenceCircularity = false;
3884638838
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
3884738839
var t = targets_3[_i];
3884838840
if (getInferenceInfoForType(t)) {
@@ -38851,18 +38843,17 @@ var ts;
3885138843
}
3885238844
else {
3885338845
for (var i = 0; i < sources.length; i++) {
38854-
var saveInferenceMatch = inferenceMatch;
38855-
inferenceMatch = false;
38846+
var saveInferencePriority = inferencePriority;
38847+
inferencePriority = 256;
3885638848
inferFromTypes(sources[i], t);
38857-
if (inferenceMatch)
38849+
if (inferencePriority === priority)
3885838850
matched_1[i] = true;
38859-
inferenceMatch = inferenceMatch || saveInferenceMatch;
38851+
inferenceCircularity = inferenceCircularity || inferencePriority === -1;
38852+
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
3886038853
}
3886138854
}
3886238855
}
38863-
var inferenceComplete = !inferenceIncomplete;
38864-
inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
38865-
if (typeVariableCount === 1 && inferenceComplete) {
38856+
if (typeVariableCount === 1 && !inferenceCircularity) {
3886638857
var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
3886738858
if (unmatched.length) {
3886838859
inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
@@ -38940,7 +38931,7 @@ var ts;
3894038931
var symbol = isNonConstructorObject ? target.symbol : undefined;
3894138932
if (symbol) {
3894238933
if (ts.contains(symbolStack, symbol)) {
38943-
inferenceIncomplete = true;
38934+
inferencePriority = -1;
3894438935
return;
3894538936
}
3894638937
(symbolStack || (symbolStack = [])).push(symbol);

lib/tsserver.js

+34-34
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var ts;
9494
// If changing the text in this section, be sure to test `configureNightly` too.
9595
ts.versionMajorMinor = "3.6";
9696
/** The version of the TypeScript compiler release */
97-
ts.version = ts.versionMajorMinor + ".1-rc";
97+
ts.version = ts.versionMajorMinor + ".2";
9898
})(ts || (ts = {}));
9999
(function (ts) {
100100
/* @internal */
@@ -3815,7 +3815,9 @@ var ts;
38153815
InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
38163816
InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
38173817
InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
3818+
InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue";
38183819
InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
3820+
InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity";
38193821
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
38203822
/* @internal */
38213823
var InferenceFlags;
@@ -46196,8 +46198,7 @@ var ts;
4619646198
var visited;
4619746199
var bivariant = false;
4619846200
var propagationType;
46199-
var inferenceMatch = false;
46200-
var inferenceIncomplete = false;
46201+
var inferencePriority = 256 /* MaxValue */;
4620146202
var allowComplexConstraintInference = true;
4620246203
inferFromTypes(originalSource, originalTarget);
4620346204
function inferFromTypes(source, target) {
@@ -46313,7 +46314,7 @@ var ts;
4631346314
clearCachedInferences(inferences);
4631446315
}
4631546316
}
46316-
inferenceMatch = true;
46317+
inferencePriority = Math.min(inferencePriority, priority);
4631746318
return;
4631846319
}
4631946320
else {
@@ -46406,21 +46407,15 @@ var ts;
4640646407
var key = source.id + "," + target.id;
4640746408
var status = visited && visited.get(key);
4640846409
if (status !== undefined) {
46409-
if (status & 1)
46410-
inferenceMatch = true;
46411-
if (status & 2)
46412-
inferenceIncomplete = true;
46410+
inferencePriority = Math.min(inferencePriority, status);
4641346411
return;
4641446412
}
46415-
(visited || (visited = ts.createMap())).set(key, 0);
46416-
var saveInferenceMatch = inferenceMatch;
46417-
var saveInferenceIncomplete = inferenceIncomplete;
46418-
inferenceMatch = false;
46419-
inferenceIncomplete = false;
46413+
(visited || (visited = ts.createMap())).set(key, -1 /* Circularity */);
46414+
var saveInferencePriority = inferencePriority;
46415+
inferencePriority = 256 /* MaxValue */;
4642046416
action(source, target);
46421-
visited.set(key, (inferenceMatch ? 1 : 0) | (inferenceIncomplete ? 2 : 0));
46422-
inferenceMatch = inferenceMatch || saveInferenceMatch;
46423-
inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
46417+
visited.set(key, inferencePriority);
46418+
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
4642446419
}
4642546420
function inferFromMatchingType(source, targets, matches) {
4642646421
var matched = false;
@@ -46490,10 +46485,11 @@ var ts;
4649046485
var nakedTypeVariable = void 0;
4649146486
var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
4649246487
var matched_1 = new Array(sources.length);
46493-
var saveInferenceIncomplete = inferenceIncomplete;
46494-
inferenceIncomplete = false;
46488+
var inferenceCircularity = false;
4649546489
// First infer to types that are not naked type variables. For each source type we
46496-
// track whether inferences were made from that particular type to some target.
46490+
// track whether inferences were made from that particular type to some target with
46491+
// equal priority (i.e. of equal quality) to what we would infer for a naked type
46492+
// parameter.
4649746493
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
4649846494
var t = targets_3[_i];
4649946495
if (getInferenceInfoForType(t)) {
@@ -46502,21 +46498,21 @@ var ts;
4650246498
}
4650346499
else {
4650446500
for (var i = 0; i < sources.length; i++) {
46505-
var saveInferenceMatch = inferenceMatch;
46506-
inferenceMatch = false;
46501+
var saveInferencePriority = inferencePriority;
46502+
inferencePriority = 256 /* MaxValue */;
4650746503
inferFromTypes(sources[i], t);
46508-
if (inferenceMatch)
46504+
if (inferencePriority === priority)
4650946505
matched_1[i] = true;
46510-
inferenceMatch = inferenceMatch || saveInferenceMatch;
46506+
inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */;
46507+
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
4651146508
}
4651246509
}
4651346510
}
46514-
var inferenceComplete = !inferenceIncomplete;
46515-
inferenceIncomplete = inferenceIncomplete || saveInferenceIncomplete;
46516-
// If the target has a single naked type variable and inference completed (meaning we
46517-
// explored the types fully), create a union of the source types from which no inferences
46518-
// have been made so far and infer from that union to the naked type variable.
46519-
if (typeVariableCount === 1 && inferenceComplete) {
46511+
// If the target has a single naked type variable and no inference circularities were
46512+
// encountered above (meaning we explored the types fully), create a union of the source
46513+
// types from which no inferences have been made so far and infer from that union to the
46514+
// naked type variable.
46515+
if (typeVariableCount === 1 && !inferenceCircularity) {
4652046516
var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
4652146517
if (unmatched.length) {
4652246518
inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
@@ -46620,7 +46616,7 @@ var ts;
4662046616
var symbol = isNonConstructorObject ? target.symbol : undefined;
4662146617
if (symbol) {
4662246618
if (ts.contains(symbolStack, symbol)) {
46623-
inferenceIncomplete = true;
46619+
inferencePriority = -1 /* Circularity */;
4662446620
return;
4662546621
}
4662646622
(symbolStack || (symbolStack = [])).push(symbol);
@@ -101202,14 +101198,18 @@ var ts;
101202101198
if (!match) {
101203101199
return false;
101204101200
}
101201+
// Limiting classification to exactly the elements and attributes
101202+
// defined in `ts.commentPragmas` would be excessive, but we can avoid
101203+
// some obvious false positives (e.g. in XML-like doc comments) by
101204+
// checking the element name.
101205+
if (!match[3] || !(match[3] in ts.commentPragmas)) {
101206+
return false;
101207+
}
101205101208
var pos = start;
101206101209
pushCommentRange(pos, match[1].length); // ///
101207101210
pos += match[1].length;
101208101211
pushClassification(pos, match[2].length, 10 /* punctuation */); // <
101209101212
pos += match[2].length;
101210-
if (!match[3]) {
101211-
return true;
101212-
}
101213101213
pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name
101214101214
pos += match[3].length;
101215101215
var attrText = match[4];
@@ -111865,7 +111865,7 @@ var ts;
111865111865
// so pass --noResolve to avoid reporting missing file errors.
111866111866
options.noResolve = true;
111867111867
// if jsx is specified then treat file as .tsx
111868-
var inputFileName = transpileOptions.fileName || (options.jsx ? "module.tsx" : "module.ts");
111868+
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
111869111869
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
111870111870
if (transpileOptions.moduleName) {
111871111871
sourceFile.moduleName = transpileOptions.moduleName;

lib/tsserverlibrary.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,9 @@ declare namespace ts {
24412441
LiteralKeyof = 32,
24422442
NoConstraints = 64,
24432443
AlwaysStrict = 128,
2444-
PriorityImpliesCombination = 56
2444+
MaxValue = 256,
2445+
PriorityImpliesCombination = 56,
2446+
Circularity = -1
24452447
}
24462448
/** @deprecated Use FileExtensionInfo instead. */
24472449
export type JsFileExtensionInfo = FileExtensionInfo;

0 commit comments

Comments
 (0)