Skip to content

Commit

Permalink
Bump version to 5.4.3 and LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
typescript-bot committed Mar 15, 2024
1 parent f42605f commit 609560f
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 131 deletions.
83 changes: 41 additions & 42 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.4";
var version = "5.4.2";
var version = "5.4.3";

// src/compiler/core.ts
var emptyArray = [];
Expand Down Expand Up @@ -57966,7 +57966,7 @@ function createTypeChecker(host) {
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
const typeVariable = typeSet[typeVarIndex];
const primitiveType = typeSet[1 - typeVarIndex];
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
const constraint = getBaseConstraintOfType(typeVariable);
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
Expand Down Expand Up @@ -58574,6 +58574,9 @@ function createTypeChecker(host) {
function isPatternLiteralType(type) {
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
}
function isGenericStringLikeType(type) {
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
}
function isGenericType(type) {
return !!getGenericObjectFlags(type);
}
Expand All @@ -58596,7 +58599,7 @@ function createTypeChecker(host) {
}
return type.objectFlags & 12582912 /* IsGenericType */;
}
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
}
function getSimplifiedType(type, writing) {
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
Expand Down Expand Up @@ -65644,7 +65647,7 @@ function createTypeChecker(host) {
function hasMatchingArgument(expression, reference) {
if (expression.arguments) {
for (const argument of expression.arguments) {
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
return true;
}
}
Expand All @@ -65654,36 +65657,6 @@ function createTypeChecker(host) {
}
return false;
}
function getCandidateDiscriminantPropertyAccess(expr, reference) {
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
const declaration = symbol.valueDeclaration;
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
return declaration;
}
}
} else if (isAccessExpression(expr)) {
if (isMatchingReference(reference, expr.expression)) {
return expr;
}
} else if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
if (isConstantVariable(symbol)) {
const declaration = symbol.valueDeclaration;
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
return declaration.initializer;
}
if (isBindingElement(declaration) && !declaration.initializer) {
const parent = declaration.parent.parent;
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
return declaration;
}
}
}
}
return void 0;
}
function getFlowNodeId(flow) {
if (!flow.id || flow.id < 0) {
flow.id = nextFlowId;
Expand Down Expand Up @@ -66783,9 +66756,39 @@ function createTypeChecker(host) {
}
return result;
}
function getCandidateDiscriminantPropertyAccess(expr) {
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
const declaration = symbol.valueDeclaration;
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
return declaration;
}
}
} else if (isAccessExpression(expr)) {
if (isMatchingReference(reference, expr.expression)) {
return expr;
}
} else if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
if (isConstantVariable(symbol)) {
const declaration = symbol.valueDeclaration;
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
return declaration.initializer;
}
if (isBindingElement(declaration) && !declaration.initializer) {
const parent = declaration.parent.parent;
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
return declaration;
}
}
}
}
return void 0;
}
function getDiscriminantPropertyAccess(expr, computedType) {
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
const access = getCandidateDiscriminantPropertyAccess(expr);
if (access) {
const name = getAccessedPropertyName(access);
if (name) {
Expand Down Expand Up @@ -72506,7 +72509,7 @@ function createTypeChecker(host) {
}
return resolveErrorCall(node);
}
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
skippedGenericFunction(node, checkMode);
return resolvingSignature;
}
Expand All @@ -72516,12 +72519,8 @@ function createTypeChecker(host) {
}
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
}
function isGenericFunctionReturningFunctionOrConstructor(signature) {
if (!signature.typeParameters) {
return false;
}
const returnType = getReturnTypeOfSignature(signature);
return isFunctionType(returnType) || isConstructorType(returnType);
function isGenericFunctionReturningFunction(signature) {
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
}
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
Expand Down
83 changes: 41 additions & 42 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);

// src/compiler/corePublic.ts
var versionMajorMinor = "5.4";
var version = "5.4.2";
var version = "5.4.3";
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
Expand Down Expand Up @@ -62710,7 +62710,7 @@ function createTypeChecker(host) {
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
const typeVariable = typeSet[typeVarIndex];
const primitiveType = typeSet[1 - typeVarIndex];
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
const constraint = getBaseConstraintOfType(typeVariable);
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
Expand Down Expand Up @@ -63318,6 +63318,9 @@ function createTypeChecker(host) {
function isPatternLiteralType(type) {
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
}
function isGenericStringLikeType(type) {
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
}
function isGenericType(type) {
return !!getGenericObjectFlags(type);
}
Expand All @@ -63340,7 +63343,7 @@ function createTypeChecker(host) {
}
return type.objectFlags & 12582912 /* IsGenericType */;
}
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
}
function getSimplifiedType(type, writing) {
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
Expand Down Expand Up @@ -70388,7 +70391,7 @@ function createTypeChecker(host) {
function hasMatchingArgument(expression, reference) {
if (expression.arguments) {
for (const argument of expression.arguments) {
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
return true;
}
}
Expand All @@ -70398,36 +70401,6 @@ function createTypeChecker(host) {
}
return false;
}
function getCandidateDiscriminantPropertyAccess(expr, reference) {
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
const declaration = symbol.valueDeclaration;
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
return declaration;
}
}
} else if (isAccessExpression(expr)) {
if (isMatchingReference(reference, expr.expression)) {
return expr;
}
} else if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
if (isConstantVariable(symbol)) {
const declaration = symbol.valueDeclaration;
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
return declaration.initializer;
}
if (isBindingElement(declaration) && !declaration.initializer) {
const parent2 = declaration.parent.parent;
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
return declaration;
}
}
}
}
return void 0;
}
function getFlowNodeId(flow) {
if (!flow.id || flow.id < 0) {
flow.id = nextFlowId;
Expand Down Expand Up @@ -71527,9 +71500,39 @@ function createTypeChecker(host) {
}
return result;
}
function getCandidateDiscriminantPropertyAccess(expr) {
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
const declaration = symbol.valueDeclaration;
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
return declaration;
}
}
} else if (isAccessExpression(expr)) {
if (isMatchingReference(reference, expr.expression)) {
return expr;
}
} else if (isIdentifier(expr)) {
const symbol = getResolvedSymbol(expr);
if (isConstantVariable(symbol)) {
const declaration = symbol.valueDeclaration;
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
return declaration.initializer;
}
if (isBindingElement(declaration) && !declaration.initializer) {
const parent2 = declaration.parent.parent;
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
return declaration;
}
}
}
}
return void 0;
}
function getDiscriminantPropertyAccess(expr, computedType) {
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
const access = getCandidateDiscriminantPropertyAccess(expr);
if (access) {
const name = getAccessedPropertyName(access);
if (name) {
Expand Down Expand Up @@ -77250,7 +77253,7 @@ function createTypeChecker(host) {
}
return resolveErrorCall(node);
}
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
skippedGenericFunction(node, checkMode);
return resolvingSignature;
}
Expand All @@ -77260,12 +77263,8 @@ function createTypeChecker(host) {
}
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
}
function isGenericFunctionReturningFunctionOrConstructor(signature) {
if (!signature.typeParameters) {
return false;
}
const returnType = getReturnTypeOfSignature(signature);
return isFunctionType(returnType) || isConstructorType(returnType);
function isGenericFunctionReturningFunction(signature) {
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
}
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
Expand Down

0 comments on commit 609560f

Please sign in to comment.