-
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.
- Loading branch information
Showing
4 changed files
with
50 additions
and
16 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,30 @@ | ||
[[syntax trees at end of typer]] // tests/printing/lambdas.scala | ||
package <empty> { | ||
final lazy module val Main: Main = new Main() | ||
final module class Main() extends Object() { this: Main.type => | ||
val f1: Int => Int = (x: Int) => x.+(1) | ||
val f2: (Int, Int) => Int = (x: Int, y: Int) => x.+(y) | ||
val f3: Int => Int => Int = (x: Int) => (y: Int) => x.+(y) | ||
val f4: [T] => (x: Int) => Int = [T >: Nothing <: Any] => (x: Int) => x.+(1) | ||
val f5: [T] => (x: Int) => Int => Int = [T >: Nothing <: Any] => (x: Int) | ||
=> (y: Int) => x.+(y) | ||
val f6: Int => Int = (x: Int) => | ||
{ | ||
val x2: Int = x.+(1) | ||
x2.+(1) | ||
} | ||
def f7(x: Int): Int = x.+(1) | ||
val f8: Int => Int = (x: Int) => Main.f7(x) | ||
val l: List[Int] = List.apply[Int]([1,2,3 : Int]*) | ||
Main.l.map[Int]((_$1: Int) => _$1.+(1)) | ||
Main.l.map[Int]((x: Int) => x.+(1)) | ||
Main.l.map[Int]((x: Int) => | ||
{ | ||
val x2: Int = x.+(1) | ||
x2.+(1) | ||
} | ||
) | ||
Main.l.map[Int]((x: Int) => Main.f7(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,14 @@ | ||
object Main: | ||
val f1 = (x: Int) => x + 1 | ||
val f2 = (x: Int, y: Int) => x + y | ||
val f3 = (x: Int) => (y: Int) => x + y | ||
val f4 = [T] => (x: Int) => x + 1 | ||
val f5 = [T] => (x: Int) => (y: Int) => x + y | ||
val f6 = (x: Int) => { val x2 = x + 1; x2 + 1 } | ||
def f7(x: Int) = x + 1 | ||
val f8 = f7 | ||
val l = List(1,2,3) | ||
l.map(_ + 1) | ||
l.map(x => x + 1) | ||
l.map(x => { val x2 = x + 1; x2 + 1 }) | ||
l.map(f7) |