[red-knot] More precise inference for classes with non-class metaclasses#15138
[red-knot] More precise inference for classes with non-class metaclasses#15138carljm merged 4 commits intoastral-sh:mainfrom
Conversation
|
5fae944 to
ec6da41
Compare
carljm
left a comment
There was a problem hiding this comment.
Looks great, thank you! Will apply my diagnostic wording nit and then merge.
|
Oops, looks like this needs a rebase before it can land. I don't have time to do that right now, but will merge if you're able to do it. |
|
Sorry, I should have clarified that it's not just a rebase -- the rebase causes logical conflicts that make compilation fail. |
Head branch was pushed to by a user without write access
22a48ec to
4b8686b
Compare
Indeed, now there's a panic that I can't make heads or tails of: Here's the code in question: def f(*args, **kwargs) -> int: ... # 169 (not even modified)
class A(metaclass=f): ... # 171 (also not modified)I'm also getting |
I can repro this, will take a couple minutes to look at it and see if I can understand it.
No, but I suspect this is related to the use of a symlink to include |
|
The panic is due to a Salsa query cycle. Still looking into why it's new after the rebase. |
Strange that our CI tests on Windows seem to have no problem with it? I can take a look tomorrow. |
|
Ok, I tracked down the cycle. It's new with the rebase because we are now doing proper call binding. What happens is that we call the metaclass I think this reveals a bug in the PR that I hadn't noticed. The first argument to the metaclass is not the actual class object, as modeled in the PR via If we correctly reflect this by passing |
|
For future reference, the technique I found most effective for tracking down the cause of the cycle was simply adding Using query tracing (in red-knot or Salsa) was ineffective in this case, because the cycle was a single-query cycle: it was just |
## Summary The symlink-approach in the typeshed-sync workflow caused some problems on Windows, even though it seemed to work fine in CI: #15138 (comment) Here, we rely on `build.rs` to patch typeshed instead, which allows us to get rid of the modifications in the workflow (thank you @MichaReiser for the idea). ## Test Plan - Made sure that changes to `knot_extensions.pyi` result in a recompile of `red_knot_vendored`.
Summary
Resolves #14208.
Test Plan
Markdown tests.