@@ -94,7 +94,7 @@ var ts;
94
94
// If changing the text in this section, be sure to test `configureNightly` too.
95
95
ts.versionMajorMinor = "3.6";
96
96
/** The version of the TypeScript compiler release */
97
- ts.version = ts.versionMajorMinor + ".1-rc ";
97
+ ts.version = ts.versionMajorMinor + ".2 ";
98
98
})(ts || (ts = {}));
99
99
(function (ts) {
100
100
/* @internal */
@@ -3815,7 +3815,9 @@ var ts;
3815
3815
InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
3816
3816
InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
3817
3817
InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
3818
+ InferencePriority[InferencePriority["MaxValue"] = 256] = "MaxValue";
3818
3819
InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
3820
+ InferencePriority[InferencePriority["Circularity"] = -1] = "Circularity";
3819
3821
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
3820
3822
/* @internal */
3821
3823
var InferenceFlags;
@@ -46196,8 +46198,7 @@ var ts;
46196
46198
var visited;
46197
46199
var bivariant = false;
46198
46200
var propagationType;
46199
- var inferenceMatch = false;
46200
- var inferenceIncomplete = false;
46201
+ var inferencePriority = 256 /* MaxValue */;
46201
46202
var allowComplexConstraintInference = true;
46202
46203
inferFromTypes(originalSource, originalTarget);
46203
46204
function inferFromTypes(source, target) {
@@ -46313,7 +46314,7 @@ var ts;
46313
46314
clearCachedInferences(inferences);
46314
46315
}
46315
46316
}
46316
- inferenceMatch = true ;
46317
+ inferencePriority = Math.min(inferencePriority, priority) ;
46317
46318
return;
46318
46319
}
46319
46320
else {
@@ -46406,21 +46407,15 @@ var ts;
46406
46407
var key = source.id + "," + target.id;
46407
46408
var status = visited && visited.get(key);
46408
46409
if (status !== undefined) {
46409
- if (status & 1)
46410
- inferenceMatch = true;
46411
- if (status & 2)
46412
- inferenceIncomplete = true;
46410
+ inferencePriority = Math.min(inferencePriority, status);
46413
46411
return;
46414
46412
}
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 */;
46420
46416
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);
46424
46419
}
46425
46420
function inferFromMatchingType(source, targets, matches) {
46426
46421
var matched = false;
@@ -46490,10 +46485,11 @@ var ts;
46490
46485
var nakedTypeVariable = void 0;
46491
46486
var sources = source.flags & 1048576 /* Union */ ? source.types : [source];
46492
46487
var matched_1 = new Array(sources.length);
46493
- var saveInferenceIncomplete = inferenceIncomplete;
46494
- inferenceIncomplete = false;
46488
+ var inferenceCircularity = false;
46495
46489
// 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.
46497
46493
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
46498
46494
var t = targets_3[_i];
46499
46495
if (getInferenceInfoForType(t)) {
@@ -46502,21 +46498,21 @@ var ts;
46502
46498
}
46503
46499
else {
46504
46500
for (var i = 0; i < sources.length; i++) {
46505
- var saveInferenceMatch = inferenceMatch ;
46506
- inferenceMatch = false ;
46501
+ var saveInferencePriority = inferencePriority ;
46502
+ inferencePriority = 256 /* MaxValue */ ;
46507
46503
inferFromTypes(sources[i], t);
46508
- if (inferenceMatch )
46504
+ if (inferencePriority === priority )
46509
46505
matched_1[i] = true;
46510
- inferenceMatch = inferenceMatch || saveInferenceMatch;
46506
+ inferenceCircularity = inferenceCircularity || inferencePriority === -1 /* Circularity */;
46507
+ inferencePriority = Math.min(inferencePriority, saveInferencePriority);
46511
46508
}
46512
46509
}
46513
46510
}
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) {
46520
46516
var unmatched = ts.flatMap(sources, function (s, i) { return matched_1[i] ? undefined : s; });
46521
46517
if (unmatched.length) {
46522
46518
inferFromTypes(getUnionType(unmatched), nakedTypeVariable);
@@ -46620,7 +46616,7 @@ var ts;
46620
46616
var symbol = isNonConstructorObject ? target.symbol : undefined;
46621
46617
if (symbol) {
46622
46618
if (ts.contains(symbolStack, symbol)) {
46623
- inferenceIncomplete = true ;
46619
+ inferencePriority = -1 /* Circularity */ ;
46624
46620
return;
46625
46621
}
46626
46622
(symbolStack || (symbolStack = [])).push(symbol);
@@ -101202,14 +101198,18 @@ var ts;
101202
101198
if (!match) {
101203
101199
return false;
101204
101200
}
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
+ }
101205
101208
var pos = start;
101206
101209
pushCommentRange(pos, match[1].length); // ///
101207
101210
pos += match[1].length;
101208
101211
pushClassification(pos, match[2].length, 10 /* punctuation */); // <
101209
101212
pos += match[2].length;
101210
- if (!match[3]) {
101211
- return true;
101212
- }
101213
101213
pushClassification(pos, match[3].length, 21 /* jsxSelfClosingTagName */); // element name
101214
101214
pos += match[3].length;
101215
101215
var attrText = match[4];
@@ -111865,7 +111865,7 @@ var ts;
111865
111865
// so pass --noResolve to avoid reporting missing file errors.
111866
111866
options.noResolve = true;
111867
111867
// 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");
111869
111869
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
111870
111870
if (transpileOptions.moduleName) {
111871
111871
sourceFile.moduleName = transpileOptions.moduleName;
0 commit comments