You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#8290: Make Expr.betaReduce give up when it sees a non-function typed closure expression
This commit addresses 2 issues with existing betaReduce behaviour:
- when given a non-function typed closure the previous iteration could easily fail to resolve the correct apply method,
or even successfully inline the wrong code (see added test cases)
- if betaReduce did not successfully inline, it would return a transformed tree. This was fine until the above change made
it possible to give up while inside a closureDef, which could insert a type ascription inside the closureDef's block,
leading to betaReduce returning invalid trees (the closureDef block can only contain a DefDef and Closure, no
type ascriptions). Fixing this issue would add meaningless complexity, so instead this commit changes betaReduce to
cleanly give up by returning the function tree unchanged, only generating the code necessary to call it.
Note: this change affects a few tests that were checking for betaReduce's slight changes to the function tree.
Testing the correctness of this change is done by adding cases to existing tests for betaReduce's treatment of type
ascriptions.
0 commit comments