[ty] implement disjointness of Callable vs SpecialForm#18503
Conversation
AlexWaygood
left a comment
There was a problem hiding this comment.
This special form is callable:
|
|
@AlexWaygood It looks like |
|
The collections proxies are callable, but the builtins proxies aren't?! That's... Odd. I had in my head that all the legacy stdlib aliases were not callable! We should probably treat them as callable if they are at runtime — can we just delegate to the constructor signatures of the classes they're aliasing? I don't love the idea of hardcoding their constructors' signatures somewhere in our model — some of those classes have reasonably complicated constructor methods IIRC |
Yeah, that should be possible. It's beyond the scope of what I was looking to do in this PR, but I added a TODO for it. |
In that case, is there any reason not to just treat them as direct aliases? That is, remove their SpecialForm type entirely and act as if |
|
PEP 585 states:
I think pyright implements this deprecation, and it would be nice if we could eventually as well. If we didn't distinguish between Edit: Hmm, come to think of it, though, we'll have the same "tricky" issue when it comes to implementing deprecation warnings for Given that we'll maybe have to solve that issue for the |
It looks like the builtin aliases are specifically excluded from being callable at runtime by passing the |
88465fd to
f7a8479
Compare
Summary
Fixes astral-sh/ty#557
Test Plan
Stable property tests succeed with a million iterations. Added mdtests.