-
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.
Backport "Fix EnclosingMethod for lifted anonfun" to LTS (#21141)
Backports #20558 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
5 changed files
with
36 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
public TB A$$anon$1.tb() |
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 @@ | ||
public TB A$$anon$2.apply() |
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 @@ | ||
// scalajs: --skip | ||
// Use of Java reflection (getEnclosingMethod) | ||
abstract class TA { def tb(): TB } | ||
abstract class TB { def chk(): Unit } | ||
class A: | ||
def a(): TA = | ||
new TA { | ||
def tb(): TB = | ||
val fn: () => TB = new Function0[TB]: | ||
def apply(): TB = new TB { | ||
def chk() = println(getClass.getEnclosingMethod()) | ||
} | ||
fn() | ||
} | ||
|
||
object Test: | ||
def main(args: Array[String]): Unit = new A().a().tb().chk() |
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,16 @@ | ||
// scalajs: --skip | ||
// Use of Java reflection (getEnclosingMethod) | ||
abstract class TA { def tb(): TB } | ||
abstract class TB { def chk(): Unit } | ||
class A: | ||
def a(): TA = | ||
new TA { | ||
def tb(): TB = | ||
val fn: () => TB = () => new TB { | ||
def chk() = println(getClass.getEnclosingMethod()) | ||
} | ||
fn() | ||
} | ||
|
||
object Test: | ||
def main(args: Array[String]): Unit = new A().a().tb().chk() |