Skip to content

Commit

Permalink
fix inlay hints incorrectly appearing on pseudo-generic classes
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Jan 27, 2025
1 parent d4a1a86 commit ebce33d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ export class TypeInlayHintsWalker extends ParseTreeWalker {
// don't show them on super calls because that's invalid.
node.d.leftExpr.d.value !== 'super' &&
// only show them on classes, because the index syntax to specify generics isn't valid on functions
isClass(callableType)
isClass(callableType) &&
// pseudo-generic classes aren't actually generic, so it's invalid to explicitly specify them
!ClassType.isPseudoGenericClass(callableType)
) {
const returnType = evaluator.getType(node);
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ def foo(self) -> None:
return super().foo()

qux: list[tuple[int, str]] = list()

class Quxx:
def __init__(self, value) -> None: ...


_ = Quxx(value=1)

0 comments on commit ebce33d

Please sign in to comment.