@@ -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;
0 commit comments