-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Enhance type analysis #7563
Merged
Merged
Enhance type analysis #7563
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
CT Test Results 2 files 294 suites 11m 4s ⏱️ Results for commit bb4990b. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
jhogberg
approved these changes
Aug 15, 2023
bjorng
force-pushed
the
bjorn/compiler/types
branch
from
August 15, 2023 11:49
15ab3a8
to
1ec8c51
Compare
Teach beam_bounds:bound/3 to determine a range for the `div` operator when nothing is known about the divisor. For example: div0(A, B) when is_integer(A), 0 =< A, A < 1204 -> %% Range for A is 0..1023 A div B. % Range is -1023..1023
Teach beam_bounds:bound/3 to determine a range for the `rem` operator when nothing is known about the right-hand side operand. For example: rem0(A, B) when is_integer(A), 0 =< A, A < 1204 -> %% Range for A is 0..1023 A rem B. % Range is 0..1023 (same as for A)
Teach beam_bounds:bounds/3 to calculate a range for the `bsl` operator when the left-hand side operand is partly unbounded. For example: bsl0(A) when is_integer(A), A >= 1 -> %% Range for A is 1..'+inf' A bsl 3. % Range is 8..'+inf' bsl1(A) when is_integer(A), A =< 10 -> %% Range for A is '-inf'..10 A bsl 3. % Range is '-inf'..80
Teach beam_bounds:bounds/3 to calculate a range for the `bor` operator for negative or partly unbounded arguments. For example: bor0(A) when is_integer(A), -10 =< A, A =< 10 -> %% Range for A is -10..10 A bor 1. % Range is '-inf'..11 bor1(A, B) when is_integer(A), A < 0, is_integer(B), B < 0 -> %% Range for A and B is '-inf'..-1 A bor B. % Range is '-inf'..-1 bor2(A, B) when is_integer(A), A >= 1, is_integer(B), B >= 10 -> %% Range for A is 1..'+inf'; range for B is 10..'+inf' A bor B. % Range is 10..'+inf'
Teach beam_bounds:bound/3 to determine a range for the `*` operator when both factors have a non-negative lower bound. For example: m(A, B) when is_integer(A), A >= 2, is_integer(B), B >= 10 -> %% Range for A is 2..'+inf'; range for B is 10..'+inf' A * B < 100. % Range for A * B is 20..'+inf'
bjorng
force-pushed
the
bjorn/compiler/types
branch
2 times, most recently
from
August 17, 2023 09:40
bb4990b
to
c5979b0
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
team:VM
Assigned to OTP team VM
testing
currently being tested, tag is used by OTP internal CI
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.
Provide type information for frequently used BIFs (such as
binary_to_list/1
). Also enhance the value range analysis for some of the arithmetic operations.