New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suboptimal typeintersections for degenerate TypeVars #53069
Comments
This is not a correctness bug. |
Is it not possible to guarantee commutativity? It really seems like an essential property for an "intersection" operation. Anyway, I stumbled upon this while trying to expand the "menagerie" of types used in the subtype test set, where commutativity of intersection is tested: Lines 1089 to 1092 in 5d4d6ab
|
Commutativity doesn't quite make sense considering over-estimation. |
After taking a quick look at the JuliaHub symbol search, I don't think many are aware of the lack of commutativity of The noncommutativity should be pointed out in the |
This is also incorrect. What packages are trying to use this pattern? |
We have a menagerie of other cases which may be similar and were noticed to be suboptimal (such that |
No packages use that patter. I'm just saying it would be an improvement over the established |
What packages use that pattern? They possibly should not use it, although there are certain circumstances where it is correct (e.g. |
Here are some cases where there's room for making
More: examples.jl.txt |
Those seem to be just examples of equal types. In particular, when the types are equal, the type system has no opinion on which one is "better", and returns the first one.
|
OK, I edited the previous message, leaving only the examples where the two type intersections aren't equal. |
Actually, when considering only packages with a significant dependent package count, I think only JSON.jl does that: |
Ah, that is very different if the third type C in the comparison is Union{} |
More examples:
intersection_commutativity_counterexamples.txt
The text was updated successfully, but these errors were encountered: