Christoph Tyralla
Christoph Tyralla
Are we sure the initial report reveals a bug or is this behaviour by design? If I am right, we can consider it only a bug if the order of...
It seems to be a known issue. I found the following test case (added by @Michael0x2a): ```python [case testIsInstanceAdHocIntersectionGenericsWithValuesDirectReturn] # flags: --warn-unreachable from typing import TypeVar class A: attr: int...
@hauntsaninja: I could not resist checking if I could solve the issue relatively cleanly. Mypy's multi-pass approach for constrained type variables makes my solution more "global" than I hoped (I...
After rethinking my approach, I decided to extend it to cover unions containing other iterable items. The result is #14440, which involves even more changes than this pull request. I...
> Something does seem to need to be done about the mapping/iterable overlap, it seems a lot of projects have very similar code which will be basically untypable right now...
> So, Pyright and (changed) Mypy behave identically, except for the unnecessary `dict[Any, Any]` returned by Mypy. I will check if this has to do with the proposed changes. After...
An additional thought. Wouldn't it be preferable to warn more strictly that type narrowing results in code that is not type-safe? Maybe the `--disallow-any-generics` option is a candidate for enabling...
Thanks for offering help! I think this is generally ready for a maintainer's review. Luckily, @hauntsaninja seems to have it already on his list. But if you have time and...
Thank you for finding this limitation (does "re-discovered" mean it's already reported?). This is because tuples are represented by `TupleType` instead of `Instance`, and this PR only captures (unions of)...
No, I thought about it and now believe it should be included in this PR. I did this in a simple manner without considering that one could narrow a tuple...