Skip to content

Commit

Permalink
Bump version to 5.1.3 and update LKG.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed May 30, 2023
1 parent 1143a21 commit 7275ded
Show file tree
Hide file tree
Showing 9 changed files with 221 additions and 138 deletions.
57 changes: 28 additions & 29 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.1";
var version = "5.1.1-rc";
var version = "5.1.3";

// src/compiler/core.ts
var emptyArray = [];
Expand Down Expand Up @@ -7704,6 +7704,7 @@ var Diagnostics = {
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
Expand Down Expand Up @@ -53984,7 +53985,7 @@ function createTypeChecker(host) {
} else if (type !== firstType) {
checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
if (isLiteralType(type) || isPatternLiteralType(type)) {
checkFlags |= 128 /* HasLiteralType */;
}
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
Expand Down Expand Up @@ -56183,31 +56184,28 @@ function createTypeChecker(host) {
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
}
function getUnionOrIntersectionTypePredicate(signatures, kind) {
let first2;
let last2;
const types = [];
for (const sig of signatures) {
const pred = getTypePredicateOfSignature(sig);
if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) {
if (kind !== 2097152 /* Intersection */) {
continue;
} else {
return;
}
}
if (first2) {
if (!typePredicateKindsMatch(first2, pred)) {
if (pred) {
if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
return void 0;
}
last2 = pred;
types.push(pred.type);
} else {
first2 = pred;
const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
if (returnType !== falseType && returnType !== regularFalseType) {
return void 0;
}
}
types.push(pred.type);
}
if (!first2) {
if (!last2) {
return void 0;
}
const compositeType = getUnionOrIntersectionType(types, kind);
return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType);
return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
}
function typePredicateKindsMatch(a, b) {
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
Expand Down Expand Up @@ -58088,18 +58086,19 @@ function createTypeChecker(host) {
case 185 /* TypeQuery */:
const entityName = node2.exprName;
const firstIdentifier = getFirstIdentifier(entityName);
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
const tpDeclaration = tp.symbol.declarations[0];
let tpScope;
if (tpDeclaration.kind === 167 /* TypeParameter */) {
tpScope = tpDeclaration.parent;
} else if (tp.isThisType) {
tpScope = tpDeclaration;
} else {
return true;
}
if (firstIdentifierSymbol.declarations) {
return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
if (!isThisIdentifier(firstIdentifier)) {
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
const tpDeclaration = tp.symbol.declarations[0];
const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
// Type parameter is a regular type parameter, e.g. foo<T>
tp.isThisType ? tpDeclaration : (
// Type parameter is the this type, and its declaration is the class declaration.
void 0
)
);
if (firstIdentifierSymbol.declarations && tpScope) {
return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
}
}
return true;
case 173 /* MethodDeclaration */:
Expand Down Expand Up @@ -81638,7 +81637,7 @@ function createTypeChecker(host) {
if (requestedExternalEmitHelperNames.has(name))
continue;
requestedExternalEmitHelperNames.add(name);
const symbol = getSymbol(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
const symbol = resolveSymbol(getSymbol(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
if (!symbol) {
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
Expand Down
97 changes: 62 additions & 35 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);

// src/compiler/corePublic.ts
var versionMajorMinor = "5.1";
var version = "5.1.1-rc";
var version = "5.1.3";
var Comparison = /* @__PURE__ */ ((Comparison3) => {
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
Expand Down Expand Up @@ -11212,6 +11212,7 @@ var Diagnostics = {
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"),
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
Expand Down Expand Up @@ -58635,7 +58636,7 @@ function createTypeChecker(host) {
} else if (type !== firstType) {
checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
if (isLiteralType(type) || isPatternLiteralType(type)) {
checkFlags |= 128 /* HasLiteralType */;
}
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
Expand Down Expand Up @@ -60834,31 +60835,28 @@ function createTypeChecker(host) {
return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin);
}
function getUnionOrIntersectionTypePredicate(signatures, kind) {
let first2;
let last2;
const types = [];
for (const sig of signatures) {
const pred = getTypePredicateOfSignature(sig);
if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) {
if (kind !== 2097152 /* Intersection */) {
continue;
} else {
return;
}
}
if (first2) {
if (!typePredicateKindsMatch(first2, pred)) {
if (pred) {
if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) {
return void 0;
}
last2 = pred;
types.push(pred.type);
} else {
first2 = pred;
const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0;
if (returnType !== falseType && returnType !== regularFalseType) {
return void 0;
}
}
types.push(pred.type);
}
if (!first2) {
if (!last2) {
return void 0;
}
const compositeType = getUnionOrIntersectionType(types, kind);
return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType);
return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType);
}
function typePredicateKindsMatch(a, b) {
return a.kind === b.kind && a.parameterIndex === b.parameterIndex;
Expand Down Expand Up @@ -62739,18 +62737,19 @@ function createTypeChecker(host) {
case 185 /* TypeQuery */:
const entityName = node2.exprName;
const firstIdentifier = getFirstIdentifier(entityName);
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
const tpDeclaration = tp.symbol.declarations[0];
let tpScope;
if (tpDeclaration.kind === 167 /* TypeParameter */) {
tpScope = tpDeclaration.parent;
} else if (tp.isThisType) {
tpScope = tpDeclaration;
} else {
return true;
}
if (firstIdentifierSymbol.declarations) {
return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
if (!isThisIdentifier(firstIdentifier)) {
const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier);
const tpDeclaration = tp.symbol.declarations[0];
const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : (
// Type parameter is a regular type parameter, e.g. foo<T>
tp.isThisType ? tpDeclaration : (
// Type parameter is the this type, and its declaration is the class declaration.
void 0
)
);
if (firstIdentifierSymbol.declarations && tpScope) {
return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference);
}
}
return true;
case 173 /* MethodDeclaration */:
Expand Down Expand Up @@ -86289,7 +86288,7 @@ function createTypeChecker(host) {
if (requestedExternalEmitHelperNames.has(name))
continue;
requestedExternalEmitHelperNames.add(name);
const symbol = getSymbol2(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */);
const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */));
if (!symbol) {
error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name);
} else if (helper & 524288 /* ClassPrivateFieldGet */) {
Expand Down Expand Up @@ -136456,15 +136455,18 @@ registerRefactor(refactorNameForMoveToFile, {
Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked");
const statements = Debug.checkDefined(getStatementsToMove(context));
Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available");
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
return { edits, renameFilename: void 0, renameLocation: void 0 };
const targetFile = interactiveRefactorArguments.targetFile;
if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) {
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences));
return { edits, renameFilename: void 0, renameLocation: void 0 };
}
return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) };
}
});
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
var _a;
const checker = program.getTypeChecker();
const usage = getUsageInfo(oldFile, toMove.all, checker);
if (!host.fileExists(targetFile) || host.fileExists(targetFile) && ((_a = program.getSourceFile(targetFile)) == null ? void 0 : _a.statements.length) === 0) {
if (!host.fileExists(targetFile)) {
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
} else {
Expand Down Expand Up @@ -136502,6 +136504,13 @@ function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, chang
if (typeof targetFile !== "string") {
if (targetFile.statements.length > 0) {
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
} else {
changes.insertNodesAtEndOfFile(
targetFile,
body,
/*blankLineBetween*/
false
);
}
if (imports.length > 0) {
insertImports(
Expand Down Expand Up @@ -141839,7 +141848,11 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
onUnRecoverableConfigFileDiagnostic: noop
};
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
let releasedScriptKinds = /* @__PURE__ */ new Set();
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
compilerHost = void 0;
parsedCommandLines = void 0;
releasedScriptKinds = void 0;
return;
}
const options = {
Expand All @@ -141852,6 +141865,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
program = createProgram(options);
compilerHost = void 0;
parsedCommandLines = void 0;
releasedScriptKinds = void 0;
sourceMapper.clearCache();
program.getTypeChecker();
return;
Expand Down Expand Up @@ -141906,10 +141920,11 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
if (!shouldCreateNewSourceFile) {
const oldSourceFile = program && program.getSourceFileByPath(path);
if (oldSourceFile) {
if (scriptKind === oldSourceFile.scriptKind) {
if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
} else {
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
releasedScriptKinds.add(oldSourceFile.resolvedPath);
}
}
}
Expand Down Expand Up @@ -165853,6 +165868,17 @@ var ChangeTracker = class {
this.insertNodeAt(sourceFile, pos, insert, options);
}
}
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
}
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
const pos = sourceFile.end + 1;
const options = {
prefix: this.newLineCharacter,
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
};
this.insertNodesAt(sourceFile, pos, insert, options);
}
insertStatementsInNewFile(fileName, statements, oldFile) {
if (!this.newFileChanges) {
this.newFileChanges = createMultiMap();
Expand Down Expand Up @@ -181964,7 +181990,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
return {
renameLocation: mappedRenameLocation,
renameFilename,
edits: this.mapTextChangesToCodeEdits(edits)
edits: this.mapTextChangesToCodeEdits(edits),
notApplicableReason: result.notApplicableReason
};
}
return result;
Expand Down
4 changes: 3 additions & 1 deletion lib/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ declare namespace ts {
*/
renameLocation?: Location;
renameFilename?: string;
notApplicableReason?: string;
}
/**
* Organize imports by:
Expand Down Expand Up @@ -10190,7 +10191,7 @@ declare namespace ts {
* arguments for any interactive action before offering it.
*/
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, includeInteractiveActions?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
newFileName: string;
files: string[];
Expand Down Expand Up @@ -10480,6 +10481,7 @@ declare namespace ts {
renameFilename?: string;
renameLocation?: number;
commands?: CodeActionCommand[];
notApplicableReason?: string;
}
type RefactorTriggerReason = "implicit" | "invoked";
interface TextInsertion {
Expand Down
Loading

0 comments on commit 7275ded

Please sign in to comment.