Skip to content

Instantly share code, notes, and snippets.

@otobrglez
Created July 26, 2021 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otobrglez/85a6421a1afe89398fb35e44c3c17db2 to your computer and use it in GitHub Desktop.
Save otobrglez/85a6421a1afe89398fb35e44c3c17db2 to your computer and use it in GitHub Desktop.
HelloWorld2 (jcdang example)
[[syntax trees at end of parser]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: _root_.scala.Function1[Int, Int] = ((x$1) => x$1.$plus(2));
println(StringContext("Hello world! This is Scala. ", "").s(add2(40)))
}
}
}
[[syntax trees at end of namer]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: _root_.scala.Function1[Int, Int] = ((x$1) => x$1.$plus(2));
println(StringContext("Hello world! This is Scala. ", "").s(add2(40)))
}
}
}
[[syntax trees at end of packageobjects]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: _root_.scala.Function1[Int, Int] = ((x$1) => x$1.$plus(2));
println(StringContext("Hello world! This is Scala. ", "").s(add2(40)))
}
}
}
[[syntax trees at end of typer]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = ((x$1: Int) => x$1.+(2));
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of superaccessors]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = ((x$1: Int) => x$1.+(2));
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of extmethods]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = ((x$1: Int) => x$1.+(2));
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of pickler]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = ((x$1: Int) => x$1.+(2));
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of refchecks]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = ((x$1: Int) => x$1.+(2));
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of patmat]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends scala.AnyRef {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = ((x$1: Int) => x$1.+(2));
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of uncurry]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of fields]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of tailcalls]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply(40)): String))
}
}
}
[[syntax trees at end of specialize]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply$mcII$sp(40)): String))
}
}
}
[[syntax trees at end of explicitouter]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Int => Int = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(add2.apply$mcII$sp(40)): String))
}
}
}
[[syntax trees at end of erasure]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Function1 = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
}
}
}
[[syntax trees at end of posterasure]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Function1 = {
final <artifact> def $anonfun$main(x$1: Int): Int = x$1.+(2);
((x$1: Int) => $anonfun$main(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
}
}
}
[[syntax trees at end of lambdalift]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
};
def main(args: Array[String]): Unit = {
val add2: Function1 = {
((x$1: Int) => HelloWorld2.this.$anonfun$main$1(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <artifact> private[this] def $anonfun$main$1(x$1: Int): Int = x$1.+(2)
}
}
[[syntax trees at end of constructors]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def main(args: Array[String]): Unit = {
val add2: Function1 = {
((x$1: Int) => HelloWorld2.this.$anonfun$main$1(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <artifact> private[this] def $anonfun$main$1(x$1: Int): Int = x$1.+(2);
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
}
}
}
[[syntax trees at end of flatten]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def main(args: Array[String]): Unit = {
val add2: Function1 = {
((x$1: Int) => HelloWorld2.this.$anonfun$main$1(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <artifact> private[this] def $anonfun$main$1(x$1: Int): Int = x$1.+(2);
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
}
}
}
[[syntax trees at end of mixin]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def main(args: Array[String]): Unit = {
val add2: Function1 = {
((x$1: Int) => HelloWorld2.this.$anonfun$main$1(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <artifact> private[this] def $anonfun$main$1(x$1: Int): Int = x$1.+(2);
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
}
}
}
[[syntax trees at end of cleanup]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def main(args: Array[String]): Unit = {
val add2: Function1 = {
((x$1: Int) => HelloWorld2.this.$anonfun$main$1(x$1))
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <artifact> private[this] def $anonfun$main$1(x$1: Int): Int = x$1.+(2);
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
}
}
}
[[syntax trees at end of delambdafy]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def main(args: Array[String]): Unit = {
val add2: Function1 = {
$anonfun()
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <static> <artifact> def $anonfun$main$1(x$1: Int): Int = x$1.+(2);
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
}
}
}
[[syntax trees at end of jvm]] // HelloWorld2.scala
package <empty> {
object HelloWorld2 extends Object {
def main(args: Array[String]): Unit = {
val add2: Function1 = {
$anonfun()
};
scala.Predef.println(("Hello world! This is Scala. ".+(scala.Int.box(add2.apply$mcII$sp(40))): String))
};
final <static> <artifact> def $anonfun$main$1(x$1: Int): Int = x$1.+(2);
def <init>(): HelloWorld2.type = {
HelloWorld2.super.<init>();
()
}
}
}
object HelloWorld2 {
def main(args: Array[String]): Unit = {
val add2: Int => Int = _ + 2
println(s"Hello world! This is Scala. ${add2(40)}")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment