-
-
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
typelimits: Prevent accidental infinite growth in size limiting #48421
Conversation
Let's try this version. |
@nanosoldier |
Your package evaluation job has completed - possible new issues were detected. |
I don't see anything that looks inference quality related |
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.
So it turned out that we don't need to remove the point 2. (forcing tupledepth
to be 1 in `type_more_complex's typevar handling)?
There's a few related issues here: 1. Type size limiting depended on the identity of contained TypeVars. E.g. `Base.rewrap_unionall(Foo{Base.unwrap_unionall(A)}, A)`, would not be limited while the equivalent with typevars substituted would be. This is obviously undesirable because the identity of typevars is an implementation detail. 2. We were forcing `tupledepth` to 1 in the typevar case to allow replacing typevars by something concrete. However, this also allowed typevars being replaced by something derived from `sources`, which could be huge and itself contain TypeVars, allowing infinite growth. 3. There was a type query that was run on types containg free typevars. This would have asserted in a debug build and gave wrong answers in a release build. Fix all three issues, which together addresses an inference non-termination seen in #48329.
4e8a388
to
b77fab2
Compare
Huh, I thought we had merged this. This was supposed to have been merged before #48329, whoops. |
In #48421 we removed all limits from apply_type, but that can lead to significant expression complexity which may be hard for subtyping to deal with. Try adding a heuristic size limiting constraint. Also do a bunch of code rearrangement and slight cleanup so that this change does not make the logic look complicated here. Solves #49127
In #48421 we removed all limits from apply_type, but that can lead to significant expression complexity which may be hard for subtyping to deal with. Try adding a heuristic size limiting constraint. Also do a bunch of code rearrangement and slight cleanup so that this change does not make the logic look complicated here. Solves #49127
In #48421 we removed all limits from apply_type, but that can lead to significant expression complexity which may be hard for subtyping to deal with. Try adding a heuristic size limiting constraint. Also do a bunch of code rearrangement and slight cleanup so that this change does not make the logic look complicated here. Solves #49127
In JuliaLang#48421 we removed all limits from apply_type, but that can lead to significant expression complexity which may be hard for subtyping to deal with. Try adding a heuristic size limiting constraint. Also do a bunch of code rearrangement and slight cleanup so that this change does not make the logic look complicated here. Solves JuliaLang#49127
There's a few related issues here:
Base.rewrap_unionall(Foo{Base.unwrap_unionall(A)}, A)
, would not be limited while the equivalent with typevars substituted would be. This is obviously undesirable because the identity of typevars is an implementation detail.tupledepth
to 1 in the typevar case to allow replacing typevars by something concrete. However, this also allowed typevars being replaced by something derived fromsources
, which could be huge and itself contain TypeVars, allowing infinite growth.Fix all three issues, which together addresses an inference non-termination seen in #48329.