-
-
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
Improve apply_type_tfunc
accuracy
#48329
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b151a53
to
6defa30
Compare
Keno
added a commit
that referenced
this pull request
Jan 26, 2023
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.
Keno
added a commit
that referenced
this pull request
Jan 28, 2023
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.
6defa30
to
cfcafb9
Compare
cfcafb9
to
7d8d6bc
Compare
@nanosoldier |
Your benchmark job has completed - no performance regressions were detected. A full report can be found here. |
apply_type_tfunc
accuracyapply_type_tfunc
accuracy
DilumAluthge
pushed a commit
that referenced
this pull request
Feb 4, 2023
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.
DilumAluthge
pushed a commit
that referenced
this pull request
Feb 4, 2023
DilumAluthge
pushed a commit
that referenced
this pull request
Feb 5, 2023
* typelimits: Prevent accidental infinite growth in size limiting 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. * wip: fix `apply_type_tfunc` accuracy (#48329) --------- Co-authored-by: Shuhei Kadowaki <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #47089.