basedpyright
basedpyright copied to clipboard
Inlay hints for inferred generics
@dataclass
class A[T]:
t: T
print(A(1))
The inlay should show on the line:
print(A`[int]`(1))
And functions:
def f[T](t: T): ...
f`[int]`(1) # WARNING: this isn't valid denotation!!!
Not sure how collection literals would look:
print(`[int]`[1, 2, 3])
print(`[int]`{1, 2, 3})
print(`[int]`{1, 2, 3})
Additionally, this is invalid syntax.
i think they should only appear in instances where it's valid (ie. only on classes, not functions or literals)
hmm, looks like inlay hints for other languages don't follow my made-up rule: https://code.visualstudio.com/docs/typescript/typescript-editing#_inlay-hints
specifically, these inlay hints would not be valid syntax if they were to be converted to real code:
so i might change my mind about this, but we need to keep #198 in mind