Fixed a crash when getting document highlights on out variance annotation (#56408)

This commit is contained in:
Mateusz Burzyński
2023-11-15 20:34:59 +01:00
committed by GitHub
parent e170bc59d4
commit d1d14e67d0
3 changed files with 18 additions and 0 deletions

View File

@@ -178,6 +178,7 @@ export namespace DocumentHighlights {
case SyntaxKind.YieldKeyword:
return highlightSpans(getYieldOccurrences(node));
case SyntaxKind.InKeyword:
case SyntaxKind.OutKeyword:
return undefined;
default:
return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement(node.parent))

View File

@@ -0,0 +1,11 @@
// === documentHighlights ===
// === /tests/cases/fourslash/documentHighlightVarianceModifiers.ts ===
// type TFoo<Value> = { value: Value };
// type TBar</*HIGHLIGHTS*/in out Value> = TFoo<Value>;
// === documentHighlights ===
// === /tests/cases/fourslash/documentHighlightVarianceModifiers.ts ===
// type TFoo<Value> = { value: Value };
// type TBar<in /*HIGHLIGHTS*/out Value> = TFoo<Value>;

View File

@@ -0,0 +1,6 @@
/// <reference path='fourslash.ts'/>
//// type TFoo<Value> = { value: Value };
//// type TBar<[|in|] [|out|] Value> = TFoo<Value>;
verify.baselineDocumentHighlights();