Skip to content

Commit

Permalink
Update LKG.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Nov 17, 2023
1 parent 756efd2 commit e2a5d45
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 64 deletions.
35 changes: 15 additions & 20 deletions lib/tsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 */;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}))
));
}
Expand Down
35 changes: 15 additions & 20 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 */;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}))
));
}
Expand Down
Loading

0 comments on commit e2a5d45

Please sign in to comment.