From a46835c2249e8351f3d395e6ebd44bfbc3fdd061 Mon Sep 17 00:00:00 2001 From: Matthew Mckee Date: Mon, 22 Dec 2025 14:00:45 +0000 Subject: [PATCH] [ty] Set flag to avoid `type[T@f]` being inserted when you double-click on the inlay (#22139) --- crates/ty_ide/src/inlay_hints.rs | 7 ------- crates/ty_python_semantic/src/types/display.rs | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/ty_ide/src/inlay_hints.rs b/crates/ty_ide/src/inlay_hints.rs index 38e12343f0..53d3fbbd88 100644 --- a/crates/ty_ide/src/inlay_hints.rs +++ b/crates/ty_ide/src/inlay_hints.rs @@ -6614,13 +6614,6 @@ mod tests { 3 | y[: type[T@f]] = x | ^^^ | - - --------------------------------------------- - info[inlay-hint-edit]: File after edits - info: Source - - def f[T](x: type[T]): - y: type[T@f] = x "#); } diff --git a/crates/ty_python_semantic/src/types/display.rs b/crates/ty_python_semantic/src/types/display.rs index 573756d1b2..e2e9c296a9 100644 --- a/crates/ty_python_semantic/src/types/display.rs +++ b/crates/ty_python_semantic/src/types/display.rs @@ -711,6 +711,7 @@ impl<'db> FmtDetailed<'db> for DisplayRepresentation<'db> { f.write_char(']') } SubclassOfInner::TypeVar(bound_typevar) => { + f.set_invalid_syntax(); f.with_type(KnownClass::Type.to_class_literal(self.db)) .write_str("type")?; f.write_char('[')?;