Skip to content

Commit 63b2695

Browse files
dependabot[bot]github-actions[bot]buke
authored
deps(deps): bump microsoft/typescript-go from b33ab79 to e027a2a (#24)
* deps(deps): bump microsoft/typescript-go from `b33ab79` to `e027a2a` Bumps [microsoft/typescript-go](https://github.com/microsoft/typescript-go) from `b33ab79` to `e027a2a`. - [Commits](microsoft/typescript-go@b33ab79...e027a2a) --- updated-dependencies: - dependency-name: microsoft/typescript-go dependency-version: e027a2a1947ac025e043a9708521af6fb92f5273 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * chore(sync): mirror internal packages into pkg/ (auto) (#25) Co-authored-by: buke <1013738+buke@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: buke <1013738+buke@users.noreply.github.com>
1 parent 65829d4 commit 63b2695

File tree

699 files changed

+592820
-2465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

699 files changed

+592820
-2465
lines changed

microsoft/typescript-go

Submodule typescript-go updated 698 files

pkg/bundled/embed.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func (vfs *wrappedFS) walkDir(rest string, walkFn vfs.WalkDirFunc) error {
131131
return err
132132
}
133133
if entry.IsDir() {
134-
if err := vfs.walkDir(name, walkFn); err != nil {
134+
if err := vfs.walkDir(strings.TrimPrefix(name, "/"), walkFn); err != nil {
135135
return err
136136
}
137137
}

pkg/checker/checker.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4271,7 +4271,7 @@ func (c *Checker) checkClassLikeDeclaration(node *ast.Node) {
42714271
}
42724272
c.checkIndexConstraints(classType, symbol, false /*isStaticIndex*/)
42734273
c.checkIndexConstraints(staticType, symbol, true /*isStaticIndex*/)
4274-
c.checkTypeForDuplicateIndexSignatures(node)
4274+
c.checkClassOrInterfaceForDuplicateIndexSignatures(node)
42754275
c.checkPropertyInitialization(node)
42764276
}
42774277

@@ -4758,14 +4758,15 @@ func (c *Checker) checkIndexConstraintForIndexSignature(t *Type, checkInfo *Inde
47584758
}
47594759
}
47604760

4761-
func (c *Checker) checkTypeForDuplicateIndexSignatures(node *ast.Node) {
4762-
if ast.IsInterfaceDeclaration(node) {
4763-
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
4764-
// to prevent this run check only for the first declaration of a given kind
4765-
if symbol := c.getSymbolOfDeclaration(node); len(symbol.Declarations) != 0 && symbol.Declarations[0] != node {
4766-
return
4767-
}
4761+
func (c *Checker) checkClassOrInterfaceForDuplicateIndexSignatures(node *ast.Node) {
4762+
// Only check the type once
4763+
if links := c.declaredTypeLinks.Get(c.getSymbolOfDeclaration(node)); !links.indexSignaturesChecked {
4764+
links.indexSignaturesChecked = true
4765+
c.checkTypeForDuplicateIndexSignatures(node)
47684766
}
4767+
}
4768+
4769+
func (c *Checker) checkTypeForDuplicateIndexSignatures(node *ast.Node) {
47694770
// TypeScript 1.0 spec (April 2014)
47704771
// 3.7.4: An object type can contain at most one string index signature and one numeric index signature.
47714772
// 8.5: A class declaration can have at most one string index member declaration and one numeric index member declaration
@@ -4865,8 +4866,8 @@ func (c *Checker) checkInterfaceDeclaration(node *ast.Node) {
48654866
symbol := c.getSymbolOfDeclaration(node)
48664867
c.checkTypeParameterListsIdentical(symbol)
48674868
// Only check this symbol once
4868-
firstInterfaceDecl := ast.GetDeclarationOfKind(symbol, ast.KindInterfaceDeclaration)
4869-
if node == firstInterfaceDecl {
4869+
if links := c.declaredTypeLinks.Get(symbol); !links.interfaceChecked {
4870+
links.interfaceChecked = true
48704871
t := c.getDeclaredTypeOfSymbol(symbol)
48714872
typeWithThis := c.getTypeWithThisArgument(t, nil, false)
48724873
// run subsequent checks only if first set succeeded
@@ -4886,7 +4887,7 @@ func (c *Checker) checkInterfaceDeclaration(node *ast.Node) {
48864887
c.checkTypeReferenceNode(heritageElement)
48874888
}
48884889
c.checkSourceElements(node.Members())
4889-
c.checkTypeForDuplicateIndexSignatures(node)
4890+
c.checkClassOrInterfaceForDuplicateIndexSignatures(node)
48904891
c.registerForUnusedIdentifiersCheck(node)
48914892
}
48924893

pkg/checker/types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,10 @@ type TypeAliasLinks struct {
193193
// Links for declared types (type parameters, class types, interface types, enums)
194194

195195
type DeclaredTypeLinks struct {
196-
declaredType *Type
197-
typeParametersChecked bool
196+
declaredType *Type
197+
interfaceChecked bool
198+
indexSignaturesChecked bool
199+
typeParametersChecked bool
198200
}
199201

200202
// Links for switch clauses

pkg/fourslash/_scripts/convertFourslash.mts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ function parseTypeScriptFiles(failingTests: Set<string>, manualTests: Set<string
6565
else if (file.endsWith(".ts") && !manualTests.has(file.slice(0, -3))) {
6666
const content = fs.readFileSync(filePath, "utf-8");
6767
const test = parseFileContent(file, content);
68+
const isServer = filePath.split(path.sep).includes("server");
6869
if (test) {
69-
const testContent = generateGoTest(failingTests, test);
70+
const testContent = generateGoTest(failingTests, test, isServer);
7071
const testPath = path.join(outputDir, `${test.name}_test.go`);
7172
fs.writeFileSync(testPath, testContent, "utf-8");
7273
}
@@ -198,6 +199,7 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined {
198199
case "baselineGoToDefinition":
199200
case "baselineGetDefinitionAtPosition":
200201
case "baselineGoToType":
202+
case "baselineGoToImplementation":
201203
// Both `baselineGoToDefinition` and `baselineGetDefinitionAtPosition` take the same
202204
// arguments, but differ in that...
203205
// - `verify.baselineGoToDefinition(...)` called getDefinitionAndBoundSpan
@@ -1130,14 +1132,14 @@ function parseBaselineDocumentHighlightsArgs(args: readonly ts.Expression[]): [V
11301132
}
11311133

11321134
function parseBaselineGoToDefinitionArgs(
1133-
funcName: "baselineGoToDefinition" | "baselineGoToType" | "baselineGetDefinitionAtPosition",
1135+
funcName: "baselineGoToDefinition" | "baselineGoToType" | "baselineGetDefinitionAtPosition" | "baselineGoToImplementation",
11341136
args: readonly ts.Expression[],
11351137
): [VerifyBaselineGoToDefinitionCmd] | undefined {
11361138
let boundSpan: true | undefined;
11371139
if (funcName === "baselineGoToDefinition") {
11381140
boundSpan = true;
11391141
}
1140-
let kind: "verifyBaselineGoToDefinition" | "verifyBaselineGoToType";
1142+
let kind: "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" | "verifyBaselineGoToImplementation";
11411143
switch (funcName) {
11421144
case "baselineGoToDefinition":
11431145
case "baselineGetDefinitionAtPosition":
@@ -1146,6 +1148,9 @@ function parseBaselineGoToDefinitionArgs(
11461148
case "baselineGoToType":
11471149
kind = "verifyBaselineGoToType";
11481150
break;
1151+
case "baselineGoToImplementation":
1152+
kind = "verifyBaselineGoToImplementation";
1153+
break;
11491154
}
11501155
const newArgs = [];
11511156
for (const arg of args) {
@@ -1824,7 +1829,7 @@ interface VerifyBaselineFindAllReferencesCmd {
18241829
}
18251830

18261831
interface VerifyBaselineGoToDefinitionCmd {
1827-
kind: "verifyBaselineGoToDefinition" | "verifyBaselineGoToType";
1832+
kind: "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" | "verifyBaselineGoToImplementation";
18281833
markers: string[];
18291834
boundSpan?: true;
18301835
ranges?: boolean;
@@ -1984,6 +1989,11 @@ function generateBaselineGoToDefinition({ markers, ranges, kind, boundSpan }: Ve
19841989
return `f.VerifyBaselineGoToTypeDefinition(t)`;
19851990
}
19861991
return `f.VerifyBaselineGoToTypeDefinition(t, ${markers.join(", ")})`;
1992+
case "verifyBaselineGoToImplementation":
1993+
if (ranges || markers.length === 0) {
1994+
return `f.VerifyBaselineGoToImplementation(t)`;
1995+
}
1996+
return `f.VerifyBaselineGoToImplementation(t, ${markers.join(", ")})`;
19871997
}
19881998
}
19891999

@@ -2038,6 +2048,7 @@ function generateCmd(cmd: Cmd): string {
20382048
return generateBaselineDocumentHighlights(cmd);
20392049
case "verifyBaselineGoToDefinition":
20402050
case "verifyBaselineGoToType":
2051+
case "verifyBaselineGoToImplementation":
20412052
return generateBaselineGoToDefinition(cmd);
20422053
case "verifyBaselineQuickInfo":
20432054
// Quick Info -> Hover
@@ -2083,7 +2094,7 @@ interface GoTest {
20832094
commands: Cmd[];
20842095
}
20852096

2086-
function generateGoTest(failingTests: Set<string>, test: GoTest): string {
2097+
function generateGoTest(failingTests: Set<string>, test: GoTest, isServer: boolean): string {
20872098
const testName = (test.name[0].toUpperCase() + test.name.substring(1)).replaceAll("-", "_").replaceAll(/[^a-zA-Z0-9_]/g, "");
20882099
const content = test.content;
20892100
const commands = test.commands.map(cmd => generateCmd(cmd)).join("\n");
@@ -2119,7 +2130,7 @@ func Test${testName}(t *testing.T) {
21192130
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
21202131
const content = ${content}
21212132
f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2122-
${commands}
2133+
${isServer ? `f.MarkTestAsStradaServer()\n` : ""}${commands}
21232134
}`;
21242135
return template;
21252136
}

0 commit comments

Comments
 (0)