From e2a5d45b51a7127ab9f9b7f4b704b3499e9fd6d3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 17 Nov 2023 18:09:50 +0000 Subject: [PATCH] Update LKG. --- lib/tsc.js | 35 +++++++++++++++-------------------- lib/tsserver.js | 35 +++++++++++++++-------------------- lib/typescript.js | 35 +++++++++++++++-------------------- lib/typingsInstaller.js | 6 ++---- 4 files changed, 47 insertions(+), 64 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index f82b0a23b018e..173935279f602 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -18,7 +18,7 @@ and limitations under the License. // src/compiler/corePublic.ts var versionMajorMinor = "5.3"; -var version = "5.3.1-rc"; +var version = "5.3.2"; // src/compiler/core.ts var emptyArray = []; @@ -10961,7 +10961,7 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */; } function isCallLikeOrFunctionLikeExpression(node) { - return isCallLikeExpression(node) || isFunctionLike(node); + return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node); } function isCallLikeExpression(node) { switch (node.kind) { @@ -18823,10 +18823,8 @@ function createNodeFactory(flags, baseFactory2) { return update(updated, original); } function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) { - const text = typeof value === "number" ? value + "" : value; - Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression"); const node = createBaseDeclaration(9 /* NumericLiteral */); - node.text = text; + node.text = typeof value === "number" ? value + "" : value; node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) node.transformFlags |= 1024 /* ContainsES2015 */; @@ -43682,7 +43680,7 @@ function createTypeChecker(host) { const nodeLinks2 = getNodeLinks(node); cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]); nodeLinks2.resolvedSignature = void 0; - if (isFunctionLike(node)) { + if (isFunctionExpressionOrArrowFunction(node)) { const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node)); const type = symbolLinks2.type; cachedTypes2.push([symbolLinks2, type]); @@ -48243,6 +48241,8 @@ function createTypeChecker(host) { context.symbolDepth.set(id, depth + 1); } context.visitedTypes.add(typeId); + const prevTrackedSymbols = context.trackedSymbols; + context.trackedSymbols = void 0; const startLength = context.approximateLength; const result = transform(type2); const addedLength = context.approximateLength - startLength; @@ -48258,6 +48258,7 @@ function createTypeChecker(host) { if (id) { context.symbolDepth.set(id, depth); } + context.trackedSymbols = prevTrackedSymbols; return result; function deepCloneOrReuseNode(node) { if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) { @@ -48560,7 +48561,7 @@ function createTypeChecker(host) { context.approximateLength += symbolName(propertySymbol).length + 1; if (propertySymbol.flags & 98304 /* Accessor */) { const writeType = getWriteTypeOfSymbol(propertySymbol); - if (propertyType !== writeType) { + if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) { const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */); const getterSignature = getSignatureFromDeclaration(getterDeclaration); typeElements.push( @@ -49483,7 +49484,7 @@ function createTypeChecker(host) { return factory.createStringLiteral(name, !!singleQuote); } if (isNumericLiteralName(name) && startsWith(name, "-")) { - return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name)))); + return factory.createComputedPropertyName(factory.createNumericLiteral(+name)); } return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); } @@ -75350,14 +75351,9 @@ function createTypeChecker(host) { case 15 /* NoSubstitutionTemplateLiteral */: case 11 /* StringLiteral */: return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text)); - case 9 /* NumericLiteral */: { + case 9 /* NumericLiteral */: checkGrammarNumericLiteral(node); - const value = +node.text; - if (!isFinite(value)) { - return numberType; - } - return getFreshTypeOfLiteralType(getNumberLiteralType(value)); - } + return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text)); case 10 /* BigIntLiteral */: checkGrammarBigIntLiteral(node); return getFreshTypeOfLiteralType(getBigIntLiteralType({ @@ -82358,7 +82354,7 @@ function createTypeChecker(host) { if (enumResult) return enumResult; const literalValue = type.value; - return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue); + return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue); } function createLiteralConstValue(node, tracker) { const type = getTypeOfSymbol(getSymbolOfDeclaration(node)); @@ -88781,7 +88777,7 @@ function transformTypeScript(context) { function transformEnumMemberDeclarationValue(member) { const value = resolver.getConstantValue(member); if (value !== void 0) { - return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value); + return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value); } else { enableSubstitutionForNonQualifiedEnumMembers(); if (member.initializer) { @@ -102959,7 +102955,7 @@ function transformGenerators(context) { if (labelExpressions === void 0) { labelExpressions = []; } - const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER); + const expression = factory2.createNumericLiteral(-1); if (labelExpressions[label] === void 0) { labelExpressions[label] = [expression]; } else { @@ -108834,8 +108830,7 @@ function transformDeclarations(context) { if (shouldStripInternal(m)) return; const constValue = resolver.getConstantValue(m); - const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue); - return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m); + return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m); })) )); } diff --git a/lib/tsserver.js b/lib/tsserver.js index c4e9b0b400a4e..0bbe3ca3e15d4 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports); // src/compiler/corePublic.ts var versionMajorMinor = "5.3"; -var version = "5.3.1-rc"; +var version = "5.3.2"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -14639,7 +14639,7 @@ function isPropertyAccessOrQualifiedName(node) { return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */; } function isCallLikeOrFunctionLikeExpression(node) { - return isCallLikeExpression(node) || isFunctionLike(node); + return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node); } function isCallLikeExpression(node) { switch (node.kind) { @@ -23031,10 +23031,8 @@ function createNodeFactory(flags, baseFactory2) { return update(updated, original); } function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) { - const text = typeof value === "number" ? value + "" : value; - Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression"); const node = createBaseDeclaration(9 /* NumericLiteral */); - node.text = text; + node.text = typeof value === "number" ? value + "" : value; node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) node.transformFlags |= 1024 /* ContainsES2015 */; @@ -48386,7 +48384,7 @@ function createTypeChecker(host) { const nodeLinks2 = getNodeLinks(node); cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]); nodeLinks2.resolvedSignature = void 0; - if (isFunctionLike(node)) { + if (isFunctionExpressionOrArrowFunction(node)) { const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node)); const type = symbolLinks2.type; cachedTypes2.push([symbolLinks2, type]); @@ -52947,6 +52945,8 @@ function createTypeChecker(host) { context.symbolDepth.set(id, depth + 1); } context.visitedTypes.add(typeId); + const prevTrackedSymbols = context.trackedSymbols; + context.trackedSymbols = void 0; const startLength = context.approximateLength; const result = transform2(type2); const addedLength = context.approximateLength - startLength; @@ -52962,6 +52962,7 @@ function createTypeChecker(host) { if (id) { context.symbolDepth.set(id, depth); } + context.trackedSymbols = prevTrackedSymbols; return result; function deepCloneOrReuseNode(node) { if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) { @@ -53264,7 +53265,7 @@ function createTypeChecker(host) { context.approximateLength += symbolName(propertySymbol).length + 1; if (propertySymbol.flags & 98304 /* Accessor */) { const writeType = getWriteTypeOfSymbol(propertySymbol); - if (propertyType !== writeType) { + if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) { const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */); const getterSignature = getSignatureFromDeclaration(getterDeclaration); typeElements.push( @@ -54187,7 +54188,7 @@ function createTypeChecker(host) { return factory.createStringLiteral(name, !!singleQuote); } if (isNumericLiteralName(name) && startsWith(name, "-")) { - return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name)))); + return factory.createComputedPropertyName(factory.createNumericLiteral(+name)); } return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); } @@ -80054,14 +80055,9 @@ function createTypeChecker(host) { case 15 /* NoSubstitutionTemplateLiteral */: case 11 /* StringLiteral */: return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text)); - case 9 /* NumericLiteral */: { + case 9 /* NumericLiteral */: checkGrammarNumericLiteral(node); - const value = +node.text; - if (!isFinite(value)) { - return numberType; - } - return getFreshTypeOfLiteralType(getNumberLiteralType(value)); - } + return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text)); case 10 /* BigIntLiteral */: checkGrammarBigIntLiteral(node); return getFreshTypeOfLiteralType(getBigIntLiteralType({ @@ -87062,7 +87058,7 @@ function createTypeChecker(host) { if (enumResult) return enumResult; const literalValue = type.value; - return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue); + return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue); } function createLiteralConstValue(node, tracker) { const type = getTypeOfSymbol(getSymbolOfDeclaration(node)); @@ -93656,7 +93652,7 @@ function transformTypeScript(context) { function transformEnumMemberDeclarationValue(member) { const value = resolver.getConstantValue(member); if (value !== void 0) { - return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value); + return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value); } else { enableSubstitutionForNonQualifiedEnumMembers(); if (member.initializer) { @@ -107834,7 +107830,7 @@ function transformGenerators(context) { if (labelExpressions === void 0) { labelExpressions = []; } - const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER); + const expression = factory2.createNumericLiteral(-1); if (labelExpressions[label] === void 0) { labelExpressions[label] = [expression]; } else { @@ -113709,8 +113705,7 @@ function transformDeclarations(context) { if (shouldStripInternal(m)) return; const constValue = resolver.getConstantValue(m); - const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue); - return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m); + return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m); })) )); } diff --git a/lib/typescript.js b/lib/typescript.js index 7805829449452..ba87f4175e501 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.3"; - version = "5.3.1-rc"; + version = "5.3.2"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -12428,7 +12428,7 @@ ${lanes.join("\n")} return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */; } function isCallLikeOrFunctionLikeExpression(node) { - return isCallLikeExpression(node) || isFunctionLike(node); + return isCallLikeExpression(node) || isFunctionExpressionOrArrowFunction(node); } function isCallLikeExpression(node) { switch (node.kind) { @@ -20845,10 +20845,8 @@ ${lanes.join("\n")} return update(updated, original); } function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) { - const text = typeof value === "number" ? value + "" : value; - Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression"); const node = createBaseDeclaration(9 /* NumericLiteral */); - node.text = text; + node.text = typeof value === "number" ? value + "" : value; node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) node.transformFlags |= 1024 /* ContainsES2015 */; @@ -46153,7 +46151,7 @@ ${lanes.join("\n")} const nodeLinks2 = getNodeLinks(node); cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]); nodeLinks2.resolvedSignature = void 0; - if (isFunctionLike(node)) { + if (isFunctionExpressionOrArrowFunction(node)) { const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node)); const type = symbolLinks2.type; cachedTypes2.push([symbolLinks2, type]); @@ -50714,6 +50712,8 @@ ${lanes.join("\n")} context.symbolDepth.set(id, depth + 1); } context.visitedTypes.add(typeId); + const prevTrackedSymbols = context.trackedSymbols; + context.trackedSymbols = void 0; const startLength = context.approximateLength; const result = transform2(type2); const addedLength = context.approximateLength - startLength; @@ -50729,6 +50729,7 @@ ${lanes.join("\n")} if (id) { context.symbolDepth.set(id, depth); } + context.trackedSymbols = prevTrackedSymbols; return result; function deepCloneOrReuseNode(node) { if (!nodeIsSynthesized(node) && getParseTreeNode(node) === node) { @@ -51031,7 +51032,7 @@ ${lanes.join("\n")} context.approximateLength += symbolName(propertySymbol).length + 1; if (propertySymbol.flags & 98304 /* Accessor */) { const writeType = getWriteTypeOfSymbol(propertySymbol); - if (propertyType !== writeType) { + if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) { const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */); const getterSignature = getSignatureFromDeclaration(getterDeclaration); typeElements.push( @@ -51954,7 +51955,7 @@ ${lanes.join("\n")} return factory.createStringLiteral(name, !!singleQuote); } if (isNumericLiteralName(name) && startsWith(name, "-")) { - return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(+name)))); + return factory.createComputedPropertyName(factory.createNumericLiteral(+name)); } return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); } @@ -77821,14 +77822,9 @@ ${lanes.join("\n")} case 15 /* NoSubstitutionTemplateLiteral */: case 11 /* StringLiteral */: return hasSkipDirectInferenceFlag(node) ? blockedStringType : getFreshTypeOfLiteralType(getStringLiteralType(node.text)); - case 9 /* NumericLiteral */: { + case 9 /* NumericLiteral */: checkGrammarNumericLiteral(node); - const value = +node.text; - if (!isFinite(value)) { - return numberType; - } - return getFreshTypeOfLiteralType(getNumberLiteralType(value)); - } + return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text)); case 10 /* BigIntLiteral */: checkGrammarBigIntLiteral(node); return getFreshTypeOfLiteralType(getBigIntLiteralType({ @@ -84829,7 +84825,7 @@ ${lanes.join("\n")} if (enumResult) return enumResult; const literalValue = type.value; - return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "string" ? factory.createStringLiteral(literalValue) : literalValue < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(Math.abs(literalValue))) : factory.createNumericLiteral(literalValue); + return typeof literalValue === "object" ? factory.createBigIntLiteral(literalValue) : typeof literalValue === "number" ? factory.createNumericLiteral(literalValue) : factory.createStringLiteral(literalValue); } function createLiteralConstValue(node, tracker) { const type = getTypeOfSymbol(getSymbolOfDeclaration(node)); @@ -91603,7 +91599,7 @@ ${lanes.join("\n")} function transformEnumMemberDeclarationValue(member) { const value = resolver.getConstantValue(member); if (value !== void 0) { - return typeof value === "string" ? factory2.createStringLiteral(value) : value < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(value))) : factory2.createNumericLiteral(value); + return typeof value === "string" ? factory2.createStringLiteral(value) : factory2.createNumericLiteral(value); } else { enableSubstitutionForNonQualifiedEnumMembers(); if (member.initializer) { @@ -105874,7 +105870,7 @@ ${lanes.join("\n")} if (labelExpressions === void 0) { labelExpressions = []; } - const expression = factory2.createNumericLiteral(Number.MAX_SAFE_INTEGER); + const expression = factory2.createNumericLiteral(-1); if (labelExpressions[label] === void 0) { labelExpressions[label] = [expression]; } else { @@ -111785,8 +111781,7 @@ ${lanes.join("\n")} if (shouldStripInternal(m)) return; const constValue = resolver.getConstantValue(m); - const newInitializer = constValue === void 0 ? void 0 : typeof constValue === "string" ? factory2.createStringLiteral(constValue) : constValue < 0 ? factory2.createPrefixUnaryExpression(41 /* MinusToken */, factory2.createNumericLiteral(Math.abs(constValue))) : factory2.createNumericLiteral(constValue); - return preserveJsDoc(factory2.updateEnumMember(m, m.name, newInitializer), m); + return preserveJsDoc(factory2.updateEnumMember(m, m.name, constValue !== void 0 ? typeof constValue === "string" ? factory2.createStringLiteral(constValue) : factory2.createNumericLiteral(constValue) : void 0), m); })) )); } diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 6dd57dedd9009..ba15aee6695a6 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -54,7 +54,7 @@ var path = __toESM(require("path")); // src/compiler/corePublic.ts var versionMajorMinor = "5.3"; -var version = "5.3.1-rc"; +var version = "5.3.2"; // src/compiler/core.ts var emptyArray = []; @@ -13041,10 +13041,8 @@ function createNodeFactory(flags, baseFactory2) { return update(updated, original); } function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) { - const text = typeof value === "number" ? value + "" : value; - Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression"); const node = createBaseDeclaration(9 /* NumericLiteral */); - node.text = text; + node.text = typeof value === "number" ? value + "" : value; node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) node.transformFlags |= 1024 /* ContainsES2015 */;