Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a setting to delay delambdafication. If set then uncurry lifts
the body of a lambda into a local def. Tests are included to show the different tree shapes.
- Loading branch information
James Iry
committed
Jul 23, 2013
1 parent
15ef90d
commit 52cdea1
Showing
6 changed files
with
117 additions
and
2 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,23 @@ | ||
[[syntax trees at end of uncurry]] // newSource1.scala | ||
package <empty> { | ||
class Foo extends Object { | ||
def <init>(): Foo = { | ||
Foo.super.<init>(); | ||
() | ||
}; | ||
def bar(): Unit = { | ||
val f: Int => Int = { | ||
@SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1[Int,Int] with Serializable { | ||
def <init>(): anonymous class $anonfun = { | ||
$anonfun.super.<init>(); | ||
() | ||
}; | ||
final def apply(x: Int): Int = x.+(1) | ||
}; | ||
(new anonymous class $anonfun(): 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,20 @@ | ||
import scala.tools.partest._ | ||
import java.io.{Console => _, _} | ||
|
||
object Test extends DirectTest { | ||
|
||
override def extraSettings: String = "-usejavacp -Xprint:uncurry -Ydelambdafy:inline -d " + testOutput.path | ||
|
||
override def code = """class Foo { | ||
| def bar = { | ||
| val f = {x: Int => x + 1} | ||
| } | ||
|} | ||
|""".stripMargin.trim | ||
|
||
override def show(): Unit = { | ||
Console.withErr(System.out) { | ||
compile() | ||
} | ||
} | ||
} |
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 @@ | ||
[[syntax trees at end of uncurry]] // newSource1.scala | ||
package <empty> { | ||
class Foo extends Object { | ||
def <init>(): Foo = { | ||
Foo.super.<init>(); | ||
() | ||
}; | ||
def bar(): Unit = { | ||
val f: Int => Int = { | ||
final <artifact> def $anonfun(x: Int): Int = x.+(1); | ||
((x: Int) => $anonfun(x)) | ||
}; | ||
() | ||
} | ||
} | ||
} | ||
|
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,20 @@ | ||
import scala.tools.partest._ | ||
import java.io.{Console => _, _} | ||
|
||
object Test extends DirectTest { | ||
|
||
override def extraSettings: String = "-usejavacp -Xprint:uncurry -Ydelambdafy:method -d " + testOutput.path | ||
|
||
override def code = """class Foo { | ||
| def bar = { | ||
| val f = {x: Int => x + 1} | ||
| } | ||
|} | ||
|""".stripMargin.trim | ||
|
||
override def show(): Unit = { | ||
Console.withErr(System.out) { | ||
compile() | ||
} | ||
} | ||
} |
52cdea1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job pr-scala failed for 52cdea1 Took 4 min. (results):
To retry exactly this commit (if the failure was spurious), comment "PLS REBUILD/pr-scala@52cdea193ee91301197b40823ac7a9354bd60a14" on PR 2887.NOTE: new commits are rebuilt automatically as they appear. There's no need to force a rebuild if you're updating the PR.