-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rewrite logic for old
<function> _
syntax (#21715)
A rewrite would previously produce uncompilable code if the access path to the eta-expanded function goes through at least one `def`. Fixes #21394
- Loading branch information
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
trait Container: | ||
def loopDef: Container | ||
val loopVal: Container | ||
def fun(x: Int)(y: Int): Int | ||
|
||
def test(c: Container): Int = | ||
use(c.fun) | ||
+ use(c.loopDef.fun) | ||
+ use(c.loopVal.fun) | ||
+ use(c.loopDef.loopDef.fun) | ||
+ use(c.loopVal.loopVal.fun) | ||
+ use(c.loopVal.loopDef.fun) | ||
+ use(c.loopDef.loopVal.fun) | ||
+ use(c.loopVal.loopDef.loopVal.fun) | ||
+ use(c.loopVal.loopDef.loopVal.loopDef.fun) | ||
|
||
def use(f: Int => Int => Int): Int = ??? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
trait Container: | ||
def loopDef: Container | ||
val loopVal: Container | ||
def fun(x: Int)(y: Int): Int | ||
|
||
def test(c: Container): Int = | ||
use(c.fun _) | ||
+ use(c.loopDef.fun _) | ||
+ use(c.loopVal.fun _) | ||
+ use(c.loopDef.loopDef.fun _) | ||
+ use(c.loopVal.loopVal.fun _) | ||
+ use(c.loopVal.loopDef.fun _) | ||
+ use(c.loopDef.loopVal.fun _) | ||
+ use(c.loopVal.loopDef.loopVal.fun _) | ||
+ use(c.loopVal.loopDef.loopVal.loopDef.fun _) | ||
|
||
def use(f: Int => Int => Int): Int = ??? |