Closed srittau closed 1 week ago
The lines aren't the same, the numbers are changing (e.g. 2155 to 2179). I think mypy internally assigns a number of each type variable, and for whatever reason those numbers can be unstable. Maybe mypy-primer could put some heuristic in its diffs to get rid of those changes.
I think GitHub doesn't color the diff because there are unpaired backticks in the text.
I guess the difference is that mypy is giving you a different TypeVar ID between the two runs. E.g. on the first run there's a ParamSpec with ID P`2153
, and on the second run there's the same signature but the ParamSpec has ID P`2179
. The presence of the backtick there is also probably what's screwing up GitHub's syntax highlighting here.
I don't know what the guarantees are about the specific numbers mypy uses for TypeVar IDs. I suspect they're not guaranteed to be stable between runs even if there are no changes in type inference. I'd imagine that hydra-zen is affected in particular here because they use a lot of higher-order functions, which is where the specific ID of each TypeVar becomes especially relevant when solving a certain TypeVar.
I guess mypy_primer could implement some custom logic that filters out diffs like this where the only change between the two runs is the numeric value of the TypeVar IDs
For a while now, mypy_primer has produced fake "diffs" for hydra_zen for each typeshed PR. They look like this:
As far as I can tell, the differing lines are actually equal. GitHub even refuses to color this diff. I'm not sure what's going on here.