Assume we always have all of the new effects unless specified otherwise #1604
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.
This will resolve #1599, #1601 and #1603.
This is a very important patch as it will also prevent further bugs like the two mentioned above by setting
.hasEffectsWhenAssigned()
and.hasEffectsWhenMutated()
to true for all nodes unless they explicitly specify it otherwise. Also, I madePromise()
impure until we have a better solution. For safety reasons, I also madePromise.reject()
impure since it can cause uncaught Promise rejections. Not sure if we will ever be able to fix this properly.New tests
assignment-to-array-buffer-view
Here the mutation of the buffer via the second view was dropped. For now, this is solved by assuming that mutating the result of a NewExpression (or CallExpression for that matter) always has an effect. This will probably prevent tree-shaking in quite a few cases but is certainly necessary for now. The situation may improve at least for non-global functions once we have function return value assignment tracking in place (will take some time, though).
Output of v0.49.2
New output
mutate-logical-expression
This was completely broken. However, instead of doing the same as for CallExpressions, I decided to implement the proper logic for LogicalExpressions. This means that if the LogicalExpression can be partially evaluated, mutating it has only an effect if mutating the result of the expression has an effect. In the future we might implement similar behaviour for ConditionalExpressions, but I decided to stick with the problem at hand for now.
Output of v0.49.2
New output
promises
By making
Promise
impure, we no longer suppress side-effects of a Promise callback. This will for now also include Promises that do not have side-effects, but I am quite sure there will be a solution for this in the future.Output of v0.49.2
New output