package fourslash_test import ( "testing" "github.com/microsoft/typescript-go/internal/fourslash" "github.com/microsoft/typescript-go/internal/testutil" ) func TestCallHierarchyUnclosedTemplateExprNoCrash1(t *testing.T) { t.Parallel() defer testutil.RecoverAndFail(t, "Panic on fourslash test") // Regression test for a crash in prepareCallHierarchy caused by parser error // recovery: when a template expression is truncated mid-call (e.g. `${format` // without closing `)`), the parser misinterprets the `class` keyword in // subsequent HTML template literals as a TypeScript class declaration. // The resulting anonymous ClassDeclaration (no name, no `default` modifier) // previously caused a "Expected call hierarchy declaration to have a reference // node" assertion failure. const content = "// @Filename: /main.ts\n" + "function updateBadge() {\n" + " const header = `