-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix #40814, fix type inference regression introduced in #40379 #40987
Conversation
Fixes the inference regression, while retaining the cases addressed by <#40379>. The same `Type`-name comparison pass (i.e. a branch of `isa(c, DataType) && t.name === c.name`) can lead to more accurate result by recursive comparison than `isType` check pass (i.e. a branch of `isType(t)`), and preferring the former over the latter fixes the regression. But just swapping the branch will lead to <#40336>, and so this PR also implements additional check to make sure `type_more_complex` still detects a single-level nesting correctly (especially, the `tt === c` parts).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @christopher-dG |
The benchmark results look okay to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to get the check exactly backwards: while the test in this function is supposed to find a reason that the recursion is safe, this instead looks if the recursion matches a known reason it is unsafe. As such, this would seem to be neither total nor transitive.
Hmm, I'm not quite sure what you mean by this. Why should inference always be conservative when seeing The comment of julia/base/compiler/typelimits.jl Lines 15 to 18 in 8535b8c
and I'm not sure why we should give up the comparison pass (i.e. |
We could delete the case for Type entirely, but we cannot move it without re-introducing the previous bug that PR fixed. The question is mainly which rule we like better. The implementation of |
…41074) Replaces JuliaLang#40987, as suggested by JuliaLang#40814.
…41074) Replaces JuliaLang#40987, as suggested by JuliaLang#40814.
Fixes the inference regression, while retaining the cases addressed by
#40379.
The same
Type
-name comparison pass (i.e. a branch ofisa(c, DataType) && t.name === c.name
)can lead to more accurate result by recursive comparison than
isType
check pass (i.e. a branch of
isType(t)
), and preferring the formerover the latter fixes the regression.
But just swapping the branch will lead to #40336,
and so this PR also implements additional check to make sure
type_more_complex
still detects a single-level nesting correctly (especially, the
tt === c
parts).