diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-04 15:59:05 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-04 15:59:05 -0800 |
commit | a17908694b89115026f587bcb8a8ed6d16768cad (patch) | |
tree | 8f1f985102a5546025aa1857b0224397453e8418 /test/pending/run | |
parent | da35106f81a5c24e78ff51c95e10052ad4f23b18 (diff) | |
parent | 7193d21a9be25bf8a705492493971f3267687098 (diff) | |
download | scala-a17908694b89115026f587bcb8a8ed6d16768cad.tar.gz scala-a17908694b89115026f587bcb8a8ed6d16768cad.tar.bz2 scala-a17908694b89115026f587bcb8a8ed6d16768cad.zip |
Merge remote-tracking branch 'kepler/topic/reifytests'
Diffstat (limited to 'test/pending/run')
-rw-r--r-- | test/pending/run/reify_csv.check | 10 | ||||
-rw-r--r-- | test/pending/run/reify_csv.scala | 42 | ||||
-rw-r--r-- | test/pending/run/t5224.check | 9 | ||||
-rw-r--r-- | test/pending/run/t5224.scala | 8 | ||||
-rw-r--r-- | test/pending/run/t5225_1.check | 4 | ||||
-rw-r--r-- | test/pending/run/t5225_1.scala | 8 | ||||
-rw-r--r-- | test/pending/run/t5225_2.check | 4 | ||||
-rw-r--r-- | test/pending/run/t5225_2.scala | 8 | ||||
-rw-r--r-- | test/pending/run/t5229_1.check | 0 | ||||
-rw-r--r-- | test/pending/run/t5229_1.scala | 14 | ||||
-rw-r--r-- | test/pending/run/t5229_2.check | 2 | ||||
-rw-r--r-- | test/pending/run/t5229_2.scala | 19 | ||||
-rw-r--r-- | test/pending/run/t5266_1.check | 2 | ||||
-rw-r--r-- | test/pending/run/t5266_1.scala | 23 | ||||
-rw-r--r-- | test/pending/run/t5266_2.check | 2 | ||||
-rw-r--r-- | test/pending/run/t5266_2.scala | 17 | ||||
-rw-r--r-- | test/pending/run/t5269.check | 1 | ||||
-rw-r--r-- | test/pending/run/t5269.scala | 22 | ||||
-rw-r--r-- | test/pending/run/t5270.check | 1 | ||||
-rw-r--r-- | test/pending/run/t5270.scala | 26 |
20 files changed, 222 insertions, 0 deletions
diff --git a/test/pending/run/reify_csv.check b/test/pending/run/reify_csv.check new file mode 100644 index 0000000000..b56f4bb50b --- /dev/null +++ b/test/pending/run/reify_csv.check @@ -0,0 +1,10 @@ +List(phase name, id, description) +record(parser,1,parse source into ASTs, perform simple desugaring) +record(namer,2,resolve names, attach symbols to named trees) +record(packageobjects,3,load package objects) +record(typer,4,the meat and potatoes: type the trees) +record(superaccessors,5,add super accessors in traits and nested classes) +record(pickler,6,serialize symbol tables) +record(refchecks,7,reference/override checking, translate nested objects) +record(selectiveanf,8,) +record(liftcode,9,reify trees) diff --git a/test/pending/run/reify_csv.scala b/test/pending/run/reify_csv.scala new file mode 100644 index 0000000000..a05a3b55d4 --- /dev/null +++ b/test/pending/run/reify_csv.scala @@ -0,0 +1,42 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val csv = """ + | phase name; id; description + | parser; 1; parse source into ASTs, perform simple desugaring + | namer; 2; resolve names, attach symbols to named trees + |packageobjects; 3; load package objects + | typer; 4; the meat and potatoes: type the trees + |superaccessors; 5; add super accessors in traits and nested classes + | pickler; 6; serialize symbol tables + | refchecks; 7; reference/override checking, translate nested objects + | selectiveanf; 8; + | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList + + val fields = csv.head.split(";").map{_.trim()}.toList + println(fields) + + val code = scala.reflect.Code.lift({ + object Csv { + case class record(`phase name`: String, id: String, description: String) + + object record { + def parse(lines: List[String]) = { + lines drop(1) map { line => line.split(";", -1).toList match { + case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim()) + case _ => throw new Exception("format error") + }} + } + } + } + + Csv.record.parse(csv) foreach println + }) + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + toolbox.runExpr(ttree) +} diff --git a/test/pending/run/t5224.check b/test/pending/run/t5224.check new file mode 100644 index 0000000000..2b920773c0 --- /dev/null +++ b/test/pending/run/t5224.check @@ -0,0 +1,9 @@ +{ + @serializable class C extends Object with ScalaObject { + def <init>() = { + super.<init>(); + () + } + }; + () +}
\ No newline at end of file diff --git a/test/pending/run/t5224.scala b/test/pending/run/t5224.scala new file mode 100644 index 0000000000..865ce4bfe9 --- /dev/null +++ b/test/pending/run/t5224.scala @@ -0,0 +1,8 @@ +import scala.reflect._ +import scala.reflect.api._ + +object Test extends App { + println(scala.reflect.Code.lift{ + @serializable class C + }.tree.toString) +}
\ No newline at end of file diff --git a/test/pending/run/t5225_1.check b/test/pending/run/t5225_1.check new file mode 100644 index 0000000000..b29cd9c365 --- /dev/null +++ b/test/pending/run/t5225_1.check @@ -0,0 +1,4 @@ +{ + @transient @volatile var x: Int = 2; + () +}
\ No newline at end of file diff --git a/test/pending/run/t5225_1.scala b/test/pending/run/t5225_1.scala new file mode 100644 index 0000000000..454502e810 --- /dev/null +++ b/test/pending/run/t5225_1.scala @@ -0,0 +1,8 @@ +import scala.reflect._ +import scala.reflect.api._ + +object Test extends App { + println(scala.reflect.Code.lift{ + @transient @volatile var x = 2 + }.tree.toString) +}
\ No newline at end of file diff --git a/test/pending/run/t5225_2.check b/test/pending/run/t5225_2.check new file mode 100644 index 0000000000..88972fd27f --- /dev/null +++ b/test/pending/run/t5225_2.check @@ -0,0 +1,4 @@ +{ + def foo(@cloneable x: Int): String = ""; + () +} diff --git a/test/pending/run/t5225_2.scala b/test/pending/run/t5225_2.scala new file mode 100644 index 0000000000..82bad0f353 --- /dev/null +++ b/test/pending/run/t5225_2.scala @@ -0,0 +1,8 @@ +import scala.reflect._ +import scala.reflect.api._ + +object Test extends App { + println(scala.reflect.Code.lift{ + def foo(@cloneable x: Int) = "" + }.tree.toString) +}
\ No newline at end of file diff --git a/test/pending/run/t5229_1.check b/test/pending/run/t5229_1.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/pending/run/t5229_1.check diff --git a/test/pending/run/t5229_1.scala b/test/pending/run/t5229_1.scala new file mode 100644 index 0000000000..1d7bf0590b --- /dev/null +++ b/test/pending/run/t5229_1.scala @@ -0,0 +1,14 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + object C + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + toolbox.runExpr(ttree) +} diff --git a/test/pending/run/t5229_2.check b/test/pending/run/t5229_2.check new file mode 100644 index 0000000000..5db6ec9b38 --- /dev/null +++ b/test/pending/run/t5229_2.check @@ -0,0 +1,2 @@ +2 +evaluated = null diff --git a/test/pending/run/t5229_2.scala b/test/pending/run/t5229_2.scala new file mode 100644 index 0000000000..67be7328a6 --- /dev/null +++ b/test/pending/run/t5229_2.scala @@ -0,0 +1,19 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + object C { + val x = 2 + } + + println(C.x) + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + val evaluated = toolbox.runExpr(ttree) + println("evaluated = " + evaluated) +} diff --git a/test/pending/run/t5266_1.check b/test/pending/run/t5266_1.check new file mode 100644 index 0000000000..3feac16a0b --- /dev/null +++ b/test/pending/run/t5266_1.check @@ -0,0 +1,2 @@ +2 +evaluated = null
\ No newline at end of file diff --git a/test/pending/run/t5266_1.scala b/test/pending/run/t5266_1.scala new file mode 100644 index 0000000000..06a81a04ea --- /dev/null +++ b/test/pending/run/t5266_1.scala @@ -0,0 +1,23 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + def x = 2 + println(x) + }; + + val settings = new Settings + settings.debug.value = true + settings.Xshowtrees.value = true + settings.Xprint.value = List("typer") + settings.printtypes.value = true + settings.Ytyperdebug.value = true + + val reporter = new ConsoleReporter(settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + val evaluated = toolbox.runExpr(ttree) + println("evaluated = " + evaluated) +}
\ No newline at end of file diff --git a/test/pending/run/t5266_2.check b/test/pending/run/t5266_2.check new file mode 100644 index 0000000000..3feac16a0b --- /dev/null +++ b/test/pending/run/t5266_2.check @@ -0,0 +1,2 @@ +2 +evaluated = null
\ No newline at end of file diff --git a/test/pending/run/t5266_2.scala b/test/pending/run/t5266_2.scala new file mode 100644 index 0000000000..cd841da021 --- /dev/null +++ b/test/pending/run/t5266_2.scala @@ -0,0 +1,17 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + def x = 2 + def y = x + println(y) + }; + + val reporter = new ConsoleReporter(settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + val evaluated = toolbox.runExpr(ttree) + println("evaluated = " + evaluated) +} diff --git a/test/pending/run/t5269.check b/test/pending/run/t5269.check new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/pending/run/t5269.check @@ -0,0 +1 @@ +2 diff --git a/test/pending/run/t5269.scala b/test/pending/run/t5269.scala new file mode 100644 index 0000000000..a30509f3fe --- /dev/null +++ b/test/pending/run/t5269.scala @@ -0,0 +1,22 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + trait Z { + val z = 2 + } + + class X extends Z { + def println() = Predef.println(z) + } + + new X().println() + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + toolbox.runExpr(ttree) +} diff --git a/test/pending/run/t5270.check b/test/pending/run/t5270.check new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/pending/run/t5270.check @@ -0,0 +1 @@ +200 diff --git a/test/pending/run/t5270.scala b/test/pending/run/t5270.scala new file mode 100644 index 0000000000..10f79790b0 --- /dev/null +++ b/test/pending/run/t5270.scala @@ -0,0 +1,26 @@ +import scala.tools.nsc.reporters._ +import scala.tools.nsc.Settings +import reflect.runtime.Mirror.ToolBox + +object Test extends App { + val code = scala.reflect.Code.lift{ + class Y { + def y = 100 + } + + trait Z { this: Y => + val z = 2 * y + } + + class X extends Y with Z { + def println() = Predef.println(z) + } + + new X().println() + }; + + val reporter = new ConsoleReporter(new Settings) + val toolbox = new ToolBox(reporter) + val ttree = toolbox.typeCheck(code.tree) + toolbox.runExpr(ttree) +} |