basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

`helpful-string` incorrectly triggers on every generic

Open DetachHead opened this issue 1 year ago • 2 comments

Describe the problem, ie expected/actual result (if it's not blatantly obvious)

No response

Gist to reproduce

from typing import TypeVar

_T = TypeVar("_T", bound=int)


def asdf(a: _T, b: int):
    print(f"{a}") # error: The type "_T@asdf" doesn't define a __format__, __str__ or __repr__ [helpful-string]
    print(f"{b}")

DetachHead avatar Dec 11 '23 09:12 DetachHead

I would make sense to use the bound for this analysis right?

KotlinIsland avatar Jan 04 '24 06:01 KotlinIsland

i think so

DetachHead avatar Jan 05 '24 04:01 DetachHead