summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-03 09:39:56 -0800
committerPaul Phillips <paulp@improving.org>2012-02-03 09:39:56 -0800
commit7ec4ba5ea921eafb092b05f580ba7381edcd8427 (patch)
tree18d2553403b64ee683536f61b59ce62035305699 /test/files
parentb4cfd1161e9f549a909d9f563f557c17dbddad00 (diff)
parent58ab20ba9b6a17c81f2f89f31f7265d2ed3b166b (diff)
downloadscala-7ec4ba5ea921eafb092b05f580ba7381edcd8427.tar.gz
scala-7ec4ba5ea921eafb092b05f580ba7381edcd8427.tar.bz2
scala-7ec4ba5ea921eafb092b05f580ba7381edcd8427.zip
Merge branch 'master' into topic/inline
Diffstat (limited to 'test/files')
-rw-r--r--test/files/buildmanager/t2562/t2562.check10
-rw-r--r--test/files/buildmanager/t2649/t2649.check4
-rw-r--r--test/files/buildmanager/t2651_4/t2651_4.check4
-rw-r--r--test/files/buildmanager/t2652/t2652.check4
-rw-r--r--test/files/buildmanager/t2653/t2653.check2
-rw-r--r--test/files/buildmanager/t2655/t2655.check4
-rw-r--r--test/files/buildmanager/t2657/t2657.check4
-rw-r--r--test/files/buildmanager/t2789/t2789.check4
-rw-r--r--test/files/neg/checksensible.check5
-rw-r--r--test/files/neg/t5352.check13
-rw-r--r--test/files/neg/t5352.flags1
-rw-r--r--test/files/neg/t5352.scala15
-rw-r--r--test/files/neg/t5426.check13
-rw-r--r--test/files/neg/t5426.flags1
-rw-r--r--test/files/neg/t5426.scala10
-rw-r--r--test/files/neg/unicode-unterminated-quote.check4
-rw-r--r--test/files/neg/unicode-unterminated-quote.scala2
-rw-r--r--test/files/run/buffer-slice.check1
-rw-r--r--test/files/run/buffer-slice.scala5
-rw-r--r--test/files/run/code.check7
-rw-r--r--test/files/run/reify_closure1.check2
-rw-r--r--test/files/run/reify_closure1.scala20
-rw-r--r--test/files/run/reify_closure2a.check2
-rw-r--r--test/files/run/reify_closure2a.scala20
-rw-r--r--test/files/run/reify_closure3a.check2
-rw-r--r--test/files/run/reify_closure3a.scala22
-rw-r--r--test/files/run/reify_closure4a.check2
-rw-r--r--test/files/run/reify_closure4a.scala22
-rw-r--r--test/files/run/reify_closure5a.check2
-rw-r--r--test/files/run/reify_closure5a.scala20
-rw-r--r--test/files/run/reify_closure6.check7
-rw-r--r--test/files/run/reify_closure6.scala28
-rw-r--r--test/files/run/reify_closure7.check6
-rw-r--r--test/files/run/reify_closure7.scala32
-rw-r--r--test/files/run/reify_closure8a.check1
-rw-r--r--test/files/run/reify_closure8a.scala17
-rw-r--r--test/files/run/reify_closures10.check2
-rw-r--r--test/files/run/reify_closures10.scala15
-rw-r--r--test/files/run/reify_complex.check1
-rw-r--r--test/files/run/reify_complex.scala31
-rw-r--r--test/files/run/reify_extendbuiltins.check1
-rw-r--r--test/files/run/reify_extendbuiltins.scala21
-rw-r--r--test/files/run/reify_generic2.check1
-rw-r--r--test/files/run/reify_generic2.scala16
-rw-r--r--test/files/run/reify_getter.check1
-rw-r--r--test/files/run/reify_getter.scala19
-rw-r--r--test/files/run/reify_implicits.check1
-rw-r--r--test/files/run/reify_implicits.scala21
-rw-r--r--test/files/run/reify_sort.check2
-rw-r--r--test/files/run/reify_sort.scala57
-rw-r--r--test/files/run/reify_sort1.check2
-rw-r--r--test/files/run/reify_sort1.scala27
-rw-r--r--test/files/run/reify_this.check5
-rw-r--r--test/files/run/reify_this.scala31
-rw-r--r--test/files/run/t5256a.check2
-rw-r--r--test/files/run/t5256a.scala9
-rw-r--r--test/files/run/t5256b.check2
-rw-r--r--test/files/run/t5256b.scala8
-rw-r--r--test/files/run/t5256d.check20
-rw-r--r--test/files/run/t5256d.scala10
-rw-r--r--test/files/run/t5256e.check2
-rw-r--r--test/files/run/t5256e.scala9
-rw-r--r--test/files/run/t5256f.check4
-rw-r--r--test/files/run/t5256f.scala19
-rw-r--r--test/files/run/t5258a.check1
-rw-r--r--test/files/run/t5258a.scala14
-rw-r--r--test/files/run/t5269.check1
-rw-r--r--test/files/run/t5269.scala22
-rw-r--r--test/files/run/t5274_1.check3
-rw-r--r--test/files/run/t5274_1.scala20
-rw-r--r--test/files/run/t5274_2.check2
-rw-r--r--test/files/run/t5274_2.scala57
-rw-r--r--test/files/run/t5275.check1
-rw-r--r--test/files/run/t5275.scala15
-rw-r--r--test/files/run/t5277_1.check1
-rw-r--r--test/files/run/t5277_1.scala21
-rw-r--r--test/files/run/t5277_2.check2
-rw-r--r--test/files/run/t5277_2.scala18
-rw-r--r--test/files/run/t5279.check1
-rw-r--r--test/files/run/t5279.scala14
-rw-r--r--test/files/run/t5335.check1
-rw-r--r--test/files/run/t5335.scala14
-rw-r--r--test/files/run/t5415.check0
-rw-r--r--test/files/run/t5415.scala14
-rw-r--r--test/files/run/t5423.check1
-rw-r--r--test/files/run/t5423.scala12
-rw-r--r--test/files/run/virtpatmat_staging.check1
-rw-r--r--test/files/run/virtpatmat_staging.flags1
-rw-r--r--test/files/run/virtpatmat_staging.scala52
-rw-r--r--test/files/run/virtpatmat_switch.check7
-rw-r--r--test/files/run/virtpatmat_switch.flags1
-rw-r--r--test/files/run/virtpatmat_switch.scala32
92 files changed, 967 insertions, 19 deletions
diff --git a/test/files/buildmanager/t2562/t2562.check b/test/files/buildmanager/t2562/t2562.check
index 390bbb9986..74575f28ea 100644
--- a/test/files/buildmanager/t2562/t2562.check
+++ b/test/files/buildmanager/t2562/t2562.check
@@ -3,10 +3,10 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(object A -> List(Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: <method>]))
-invalidate B.scala because it references changed definition [Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: <method>]]
+Changes: Map(object A -> List(Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: <method> <triedcooking>]))
+invalidate B.scala because it references changed definition [Changed(Definition(A.x3))[method x3 changed from ()Int to ()String flags: <method> <triedcooking>]]
compiling Set(B.scala)
-Changes: Map(object B -> List(Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: <method>]))
-invalidate A.scala because it references changed definition [Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: <method>]]
+Changes: Map(object B -> List(Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: <method> <triedcooking>]))
+invalidate A.scala because it references changed definition [Changed(Definition(B.x2))[method x2 changed from ()Int to ()String flags: <method> <triedcooking>]]
compiling Set(A.scala, B.scala)
-Changes: Map(object A -> List(Changed(Definition(A.x0))[method x0 changed from ()Int to ()String flags: <method>], Changed(Definition(A.x1))[method x1 changed from ()Int to ()String flags: <method>], Changed(Definition(A.x2))[method x2 changed from ()Int to ()String flags: <method>]), object B -> List(Changed(Definition(B.x0))[method x0 changed from ()Int to ()String flags: <method>], Changed(Definition(B.x1))[method x1 changed from ()Int to ()String flags: <method>]))
+Changes: Map(object A -> List(Changed(Definition(A.x0))[method x0 changed from ()Int to ()String flags: <method>], Changed(Definition(A.x1))[method x1 changed from ()Int to ()String flags: <method> <triedcooking>], Changed(Definition(A.x2))[method x2 changed from ()Int to ()String flags: <method> <triedcooking>]), object B -> List(Changed(Definition(B.x0))[method x0 changed from ()Int to ()String flags: <method>], Changed(Definition(B.x1))[method x1 changed from ()Int to ()String flags: <method>]))
diff --git a/test/files/buildmanager/t2649/t2649.check b/test/files/buildmanager/t2649/t2649.check
index 390f284fd3..d0f41f32ec 100644
--- a/test/files/buildmanager/t2649/t2649.check
+++ b/test/files/buildmanager/t2649/t2649.check
@@ -3,7 +3,7 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (zz: Int, yy: Int)Int to (yy: Int, zz: Int)Int flags: <method>]))
-invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (zz: Int, yy: Int)Int to (yy: Int, zz: Int)Int flags: <method>]]
+Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (zz: Int, yy: Int)Int to (yy: Int, zz: Int)Int flags: <method> <triedcooking>]))
+invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (zz: Int, yy: Int)Int to (yy: Int, zz: Int)Int flags: <method> <triedcooking>]]
compiling Set(B.scala)
Changes: Map(object B -> List())
diff --git a/test/files/buildmanager/t2651_4/t2651_4.check b/test/files/buildmanager/t2651_4/t2651_4.check
index c4ce382b5f..b182f31c09 100644
--- a/test/files/buildmanager/t2651_4/t2651_4.check
+++ b/test/files/buildmanager/t2651_4/t2651_4.check
@@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(trait A -> List(Changed(Definition(A.x))[method x changed from ()T to ()T flags: <deferred> <method>], Changed(Definition(A.y))[method y changed from (a: T)Unit to (a: T)Unit flags: <deferred> <method>], Changed(Definition(A.z))[method z changed from [B <: T]()Unit to [B <: T]()Unit flags: <deferred> <method>]))
-invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from ()T to ()T flags: <deferred> <method>]]
+Changes: Map(trait A -> List(Changed(Definition(A.x))[method x changed from ()T to ()T flags: <deferred> <method> <triedcooking>], Changed(Definition(A.y))[method y changed from (a: T)Unit to (a: T)Unit flags: <deferred> <method>], Changed(Definition(A.z))[method z changed from [B <: T]()Unit to [B <: T]()Unit flags: <deferred> <method>]))
+invalidate B.scala because inherited method changed [Changed(Definition(A.x))[method x changed from ()T to ()T flags: <deferred> <method> <triedcooking>]]
compiling Set(B.scala)
B.scala:2: error: type mismatch;
found : Int(3)
diff --git a/test/files/buildmanager/t2652/t2652.check b/test/files/buildmanager/t2652/t2652.check
index f517f9e95a..071281c6ff 100644
--- a/test/files/buildmanager/t2652/t2652.check
+++ b/test/files/buildmanager/t2652/t2652.check
@@ -3,7 +3,7 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(class A -> List(Added(Definition(A.x$mBc$sp)), Added(Definition(A.x$mCc$sp)), Added(Definition(A.x$mDc$sp)), Added(Definition(A.x$mFc$sp)), Added(Definition(A.x$mIc$sp)), Added(Definition(A.x$mJc$sp)), Added(Definition(A.x$mSc$sp)), Added(Definition(A.x$mVc$sp)), Added(Definition(A.x$mZc$sp)), Changed(Definition(A.x))[method x changed from [T](t: T)T to [T](t: T)T flags: <method>]))
-invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from [T](t: T)T to [T](t: T)T flags: <method>]]
+Changes: Map(class A -> List(Added(Definition(A.x$mBc$sp)), Added(Definition(A.x$mCc$sp)), Added(Definition(A.x$mDc$sp)), Added(Definition(A.x$mFc$sp)), Added(Definition(A.x$mIc$sp)), Added(Definition(A.x$mJc$sp)), Added(Definition(A.x$mSc$sp)), Added(Definition(A.x$mVc$sp)), Added(Definition(A.x$mZc$sp)), Changed(Definition(A.x))[method x changed from [T](t: T)T to [T](t: T)T flags: <method> <triedcooking>]))
+invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from [T](t: T)T to [T](t: T)T flags: <method> <triedcooking>]]
compiling Set(B.scala)
Changes: Map(object B -> List())
diff --git a/test/files/buildmanager/t2653/t2653.check b/test/files/buildmanager/t2653/t2653.check
index 6a4fc0e982..36781522af 100644
--- a/test/files/buildmanager/t2653/t2653.check
+++ b/test/files/buildmanager/t2653/t2653.check
@@ -3,7 +3,7 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(class A -> List(Changed(Class(A))[ tparams: List((type T,type T))], Changed(Definition(A.<init>))[constructor A changed from ()A[T] to ()A[T] flags: <method>]))
+Changes: Map(class A -> List(Changed(Class(A))[ tparams: List((type T,type T))], Changed(Definition(A.<init>))[constructor A changed from ()A[T] to ()A[T] flags: <method> <triedcooking>]))
invalidate B.scala because it references changed class [Changed(Class(A))[ tparams: List((type T,type T))]]
compiling Set(B.scala)
B.scala:2: error: type mismatch;
diff --git a/test/files/buildmanager/t2655/t2655.check b/test/files/buildmanager/t2655/t2655.check
index c473e9fd6e..41ce65a2f5 100644
--- a/test/files/buildmanager/t2655/t2655.check
+++ b/test/files/buildmanager/t2655/t2655.check
@@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: <method>]))
-invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: <method>]]
+Changes: Map(object A -> List(Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: <method> <triedcooking>]))
+invalidate B.scala because it references changed definition [Changed(Definition(A.x))[method x changed from (i: Function0)Unit to (i: Function0)Unit flags: <method> <triedcooking>]]
compiling Set(B.scala)
B.scala:2: error: type mismatch;
found : String("3")
diff --git a/test/files/buildmanager/t2657/t2657.check b/test/files/buildmanager/t2657/t2657.check
index 3fd0e0666d..74ba87a21d 100644
--- a/test/files/buildmanager/t2657/t2657.check
+++ b/test/files/buildmanager/t2657/t2657.check
@@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(class A -> List(Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: implicit <method>]))
-invalidate B.scala because inherited method changed [Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: implicit <method>]]
+Changes: Map(class A -> List(Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: implicit <method> <triedcooking>]))
+invalidate B.scala because inherited method changed [Changed(Definition(A.y))[method y changed from (i: Int)String to (i: Int)String flags: implicit <method> <triedcooking>]]
compiling Set(B.scala)
B.scala:2: error: type mismatch;
found : Int(3)
diff --git a/test/files/buildmanager/t2789/t2789.check b/test/files/buildmanager/t2789/t2789.check
index 78c5119355..a7c767cc45 100644
--- a/test/files/buildmanager/t2789/t2789.check
+++ b/test/files/buildmanager/t2789/t2789.check
@@ -3,8 +3,8 @@ compiling Set(A.scala, B.scala)
Changes: Map()
builder > A.scala
compiling Set(A.scala)
-Changes: Map(class A -> List(Changed(Definition(A.e))[method e changed from ()E to ()E flags: implicit <method>]), class E -> List())
-invalidate B.scala because inherited method changed [Changed(Definition(A.e))[method e changed from ()E to ()E flags: implicit <method>]]
+Changes: Map(class A -> List(Changed(Definition(A.e))[method e changed from ()E to ()E flags: implicit <method> <triedcooking>]), class E -> List())
+invalidate B.scala because inherited method changed [Changed(Definition(A.e))[method e changed from ()E to ()E flags: implicit <method> <triedcooking>]]
compiling Set(B.scala)
B.scala:2: error: could not find implicit value for parameter y: E
val y = x(3)
diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check
index 0881205bb4..d785179a56 100644
--- a/test/files/neg/checksensible.check
+++ b/test/files/neg/checksensible.check
@@ -28,6 +28,9 @@ checksensible.scala:27: error: comparing values of types Int and Unit using `=='
checksensible.scala:29: error: comparing values of types Int and String using `==' will always yield false
1 == "abc"
^
+checksensible.scala:33: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ Some(1) == 1 // as above
+ ^
checksensible.scala:38: error: comparing a fresh object using `==' will always yield false
new AnyRef == 1
^
@@ -94,4 +97,4 @@ checksensible.scala:84: error: comparing values of types EqEqRefTest.this.C3 and
checksensible.scala:95: error: comparing values of types Unit and Int using `!=' will always yield true
while ((c = in.read) != -1)
^
-32 errors found
+33 errors found
diff --git a/test/files/neg/t5352.check b/test/files/neg/t5352.check
new file mode 100644
index 0000000000..d24b0e8ee1
--- /dev/null
+++ b/test/files/neg/t5352.check
@@ -0,0 +1,13 @@
+t5352.scala:11: error: type mismatch;
+ found : boop.Bar
+ required: boop.BarF
+ (which expands to) AnyRef{def f(): Int}
+ x = xs.head
+ ^
+t5352.scala:14: error: method f in class Bar1 cannot be accessed in boop.Bar1
+ Access to protected method f not permitted because
+ enclosing object boop is not a subclass of
+ class Bar1 in object boop where target is defined
+ (new Bar1).f
+ ^
+two errors found
diff --git a/test/files/neg/t5352.flags b/test/files/neg/t5352.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t5352.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t5352.scala b/test/files/neg/t5352.scala
new file mode 100644
index 0000000000..6ee41f5680
--- /dev/null
+++ b/test/files/neg/t5352.scala
@@ -0,0 +1,15 @@
+object boop {
+ abstract class Bar { protected def f(): Any }
+ class Bar1 extends Bar { protected def f(): Int = 5 }
+ class Bar2 extends Bar { protected def f(): Int = 5 }
+
+ val xs = List(new Bar1, new Bar2)
+
+ type BarF = { def f(): Int }
+
+ var x: BarF = _
+ x = xs.head
+ x.f
+
+ (new Bar1).f
+}
diff --git a/test/files/neg/t5426.check b/test/files/neg/t5426.check
new file mode 100644
index 0000000000..d9e192d3f0
--- /dev/null
+++ b/test/files/neg/t5426.check
@@ -0,0 +1,13 @@
+t5426.scala:2: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ def f1 = Some(5) == 5
+ ^
+t5426.scala:3: error: comparing values of types Int and Some[Int] using `==' will always yield false
+ def f2 = 5 == Some(5)
+ ^
+t5426.scala:8: error: comparing values of types Int and Some[Int] using `==' will always yield false
+ (x1 == x2)
+ ^
+t5426.scala:9: error: comparing values of types Some[Int] and Int using `==' will always yield false
+ (x2 == x1)
+ ^
+four errors found
diff --git a/test/files/neg/t5426.flags b/test/files/neg/t5426.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t5426.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t5426.scala b/test/files/neg/t5426.scala
new file mode 100644
index 0000000000..f2fb5cc12c
--- /dev/null
+++ b/test/files/neg/t5426.scala
@@ -0,0 +1,10 @@
+class A {
+ def f1 = Some(5) == 5
+ def f2 = 5 == Some(5)
+
+ val x1 = 5
+ val x2 = Some(5)
+
+ (x1 == x2)
+ (x2 == x1)
+}
diff --git a/test/files/neg/unicode-unterminated-quote.check b/test/files/neg/unicode-unterminated-quote.check
new file mode 100644
index 0000000000..fc5caa6d7e
--- /dev/null
+++ b/test/files/neg/unicode-unterminated-quote.check
@@ -0,0 +1,4 @@
+unicode-unterminated-quote.scala:2: error: unclosed string literal
+ val x = /u0022
+ ^
+one error found
diff --git a/test/files/neg/unicode-unterminated-quote.scala b/test/files/neg/unicode-unterminated-quote.scala
new file mode 100644
index 0000000000..bb6eab667f
--- /dev/null
+++ b/test/files/neg/unicode-unterminated-quote.scala
@@ -0,0 +1,2 @@
+class A {
+ val x = \u0022 \ No newline at end of file
diff --git a/test/files/run/buffer-slice.check b/test/files/run/buffer-slice.check
new file mode 100644
index 0000000000..5287aa9d7b
--- /dev/null
+++ b/test/files/run/buffer-slice.check
@@ -0,0 +1 @@
+ArrayBuffer()
diff --git a/test/files/run/buffer-slice.scala b/test/files/run/buffer-slice.scala
new file mode 100644
index 0000000000..ddd82e0751
--- /dev/null
+++ b/test/files/run/buffer-slice.scala
@@ -0,0 +1,5 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ println(scala.collection.mutable.ArrayBuffer().slice(102450392, -2045033354))
+ }
+}
diff --git a/test/files/run/code.check b/test/files/run/code.check
index b946554fda..9b0351bbf9 100644
--- a/test/files/run/code.check
+++ b/test/files/run/code.check
@@ -1,29 +1,36 @@
testing: ((x: Int) => x.$plus(ys.length))
+type is: Int => Int
result = ((x: Int) => x.+{(x: <?>)Int}(ys.length{Int}){Int}){Int => Int}
evaluated = <function1>
testing: (() => {
val e: Element = new Element("someName");
e
})
+type is: () => Element
result = (() => {
val e: Element = new Element{Element}{(name: <?>)Element}("someName"{String("someName")}){Element};
e{Element}
}{Element}){() => Element}
evaluated = Element(someName)
testing: (() => truc.elem = 6)
+type is: () => Unit
result = (() => truc.elem{Int} = 6{Int(6)}{Unit}){() => Unit}
evaluated = null
testing: (() => truc.elem = truc.elem.$plus(6))
+type is: () => Unit
result = (() => truc.elem{Int} = truc.elem.+{(x: <?>)Int}(6{Int(6)}){Int}{Unit}){() => Unit}
evaluated = null
testing: (() => new baz.BazElement("someName"))
+type is: () => baz.BazElement
result = (() => new baz.BazElement{baz.BazElement}{(name: <?>)baz.BazElement}("someName"{String("someName")}){baz.BazElement}){() => baz.BazElement}
evaluated = BazElement(someName)
testing: ((x: Int) => x.$plus(ys.length))
+type is: Int => Int
result = ((x: Int) => x.+{(x: <?>)Int}(ys.length{Int}){Int}){Int => Int}
evaluated = <function1>
static: 2
testing: (() => x.$plus(1))
+type is: () => Int
result = (() => x.+{(x: <?>)Int}(1{Int(1)}){Int}){() => Int}
evaluated = 2
1+1 = 2
diff --git a/test/files/run/reify_closure1.check b/test/files/run/reify_closure1.check
new file mode 100644
index 0000000000..b2f7f08c17
--- /dev/null
+++ b/test/files/run/reify_closure1.check
@@ -0,0 +1,2 @@
+10
+10
diff --git a/test/files/run/reify_closure1.scala b/test/files/run/reify_closure1.scala
new file mode 100644
index 0000000000..825a38dc1d
--- /dev/null
+++ b/test/files/run/reify_closure1.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo[T](ys: List[T]): Int => Int = {
+ val fun: reflect.Code[Int => Int] = x => {
+ x
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(List(1, 2, 3))(10))
+ println(foo(List(1, 2, 3, 4))(10))
+}
diff --git a/test/files/run/reify_closure2a.check b/test/files/run/reify_closure2a.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/files/run/reify_closure2a.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/files/run/reify_closure2a.scala b/test/files/run/reify_closure2a.scala
new file mode 100644
index 0000000000..b88bec005d
--- /dev/null
+++ b/test/files/run/reify_closure2a.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/files/run/reify_closure3a.check b/test/files/run/reify_closure3a.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/files/run/reify_closure3a.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/files/run/reify_closure3a.scala b/test/files/run/reify_closure3a.scala
new file mode 100644
index 0000000000..6414fa58a3
--- /dev/null
+++ b/test/files/run/reify_closure3a.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ def y1 = y
+
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y1
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/files/run/reify_closure4a.check b/test/files/run/reify_closure4a.check
new file mode 100644
index 0000000000..c1f3abd7e6
--- /dev/null
+++ b/test/files/run/reify_closure4a.check
@@ -0,0 +1,2 @@
+11
+12
diff --git a/test/files/run/reify_closure4a.scala b/test/files/run/reify_closure4a.scala
new file mode 100644
index 0000000000..99e9d82706
--- /dev/null
+++ b/test/files/run/reify_closure4a.scala
@@ -0,0 +1,22 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo(y: Int): Int => Int = {
+ val y1 = y
+
+ val fun: reflect.Code[Int => Int] = x => {
+ x + y1
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(1)(10))
+ println(foo(2)(10))
+}
diff --git a/test/files/run/reify_closure5a.check b/test/files/run/reify_closure5a.check
new file mode 100644
index 0000000000..df9e19c591
--- /dev/null
+++ b/test/files/run/reify_closure5a.check
@@ -0,0 +1,2 @@
+13
+14
diff --git a/test/files/run/reify_closure5a.scala b/test/files/run/reify_closure5a.scala
new file mode 100644
index 0000000000..0ac53d5479
--- /dev/null
+++ b/test/files/run/reify_closure5a.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ def foo[T](ys: List[T]): Int => Int = {
+ val fun: reflect.Code[Int => Int] = x => {
+ x + ys.length
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println(foo(List(1, 2, 3))(10))
+ println(foo(List(1, 2, 3, 4))(10))
+}
diff --git a/test/files/run/reify_closure6.check b/test/files/run/reify_closure6.check
new file mode 100644
index 0000000000..b9de4c6baf
--- /dev/null
+++ b/test/files/run/reify_closure6.check
@@ -0,0 +1,7 @@
+q = 1
+y = 1
+first invocation = 15
+q = 2
+y = 1
+second invocation = 17
+q after second invocation = 2 \ No newline at end of file
diff --git a/test/files/run/reify_closure6.scala b/test/files/run/reify_closure6.scala
new file mode 100644
index 0000000000..54f1791bf2
--- /dev/null
+++ b/test/files/run/reify_closure6.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ var q = 0
+ def foo[T](ys: List[T]): Int => Int = {
+ val z = 1
+ var y = 0
+ val fun: reflect.Code[Int => Int] = x => {
+ y += 1
+ q += 1
+ println("q = " + q)
+ println("y = " + y)
+ x + ys.length * z + q + y
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ dyn.asInstanceOf[Int => Int]
+ }
+
+ println("first invocation = " + foo(List(1, 2, 3))(10))
+ println("second invocation = " + foo(List(1, 2, 3, 4))(10))
+ println("q after second invocation = " + q)
+} \ No newline at end of file
diff --git a/test/files/run/reify_closure7.check b/test/files/run/reify_closure7.check
new file mode 100644
index 0000000000..bf58b52bce
--- /dev/null
+++ b/test/files/run/reify_closure7.check
@@ -0,0 +1,6 @@
+q = 1
+y = 1
+first invocation = 15
+q = 2
+y = 2
+second invocation = 17
diff --git a/test/files/run/reify_closure7.scala b/test/files/run/reify_closure7.scala
new file mode 100644
index 0000000000..8933df23fa
--- /dev/null
+++ b/test/files/run/reify_closure7.scala
@@ -0,0 +1,32 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ var q = 0
+ var clo: Int => Int = null
+ def foo[T](ys: List[T]): Int => Int = {
+ val z = 1
+ var y = 0
+ val fun: reflect.Code[Int => Int] = x => {
+ y += 1
+ q += 1
+ println("q = " + q)
+ println("y = " + y)
+ x + ys.length * z + q + y
+ }
+
+ if (clo == null) {
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ clo = dyn.asInstanceOf[Int => Int]
+ }
+
+ clo
+ }
+
+ println("first invocation = " + foo(List(1, 2, 3))(10))
+ println("second invocation = " + foo(List(1, 2, 3, 4))(10))
+}
diff --git a/test/files/run/reify_closure8a.check b/test/files/run/reify_closure8a.check
new file mode 100644
index 0000000000..9a037142aa
--- /dev/null
+++ b/test/files/run/reify_closure8a.check
@@ -0,0 +1 @@
+10 \ No newline at end of file
diff --git a/test/files/run/reify_closure8a.scala b/test/files/run/reify_closure8a.scala
new file mode 100644
index 0000000000..5e54bfc8c7
--- /dev/null
+++ b/test/files/run/reify_closure8a.scala
@@ -0,0 +1,17 @@
+import scala.reflect.Code._
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ class Foo(val y: Int) {
+ def fun = lift{y}
+ }
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(new Foo(10).fun.tree)
+ val dyn = toolbox.runExpr(ttree)
+ val foo = dyn.asInstanceOf[Int]
+ println(foo)
+}
diff --git a/test/files/run/reify_closures10.check b/test/files/run/reify_closures10.check
new file mode 100644
index 0000000000..fd3c81a4d7
--- /dev/null
+++ b/test/files/run/reify_closures10.check
@@ -0,0 +1,2 @@
+5
+5
diff --git a/test/files/run/reify_closures10.scala b/test/files/run/reify_closures10.scala
new file mode 100644
index 0000000000..d0f895ae4d
--- /dev/null
+++ b/test/files/run/reify_closures10.scala
@@ -0,0 +1,15 @@
+import scala.reflect.Code._
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+object Test extends App {
+ val x = 2
+ val y = 3
+ val code = lift{println(x + y); x + y}
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ println(toolbox.runExpr(ttree))
+}
diff --git a/test/files/run/reify_complex.check b/test/files/run/reify_complex.check
new file mode 100644
index 0000000000..7df35e33a0
--- /dev/null
+++ b/test/files/run/reify_complex.check
@@ -0,0 +1 @@
+3.0+4.0*i
diff --git a/test/files/run/reify_complex.scala b/test/files/run/reify_complex.scala
new file mode 100644
index 0000000000..aae4d558cf
--- /dev/null
+++ b/test/files/run/reify_complex.scala
@@ -0,0 +1,31 @@
+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 Complex(val re: Double, val im: Double) {
+ def + (that: Complex) =
+ new Complex(re + that.re, im + that.im)
+ def - (that: Complex) =
+ new Complex(re - that.re, im - that.im)
+ def * (that: Complex) =
+ new Complex(re * that.re - im * that.im,
+ re * that.im + im * that.re)
+ def / (that: Complex) = {
+ val denom = that.re * that.re + that.im * that.im
+ new Complex((re * that.re + im * that.im) / denom,
+ (im * that.re - re * that.im) / denom)
+ }
+ override def toString =
+ re + (if (im < 0) "-" + (-im) else "+" + im) + "*i"
+ }
+ val x = new Complex(2, 1); val y = new Complex(1, 3)
+ println(x + y)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_extendbuiltins.check b/test/files/run/reify_extendbuiltins.check
new file mode 100644
index 0000000000..a48033a30d
--- /dev/null
+++ b/test/files/run/reify_extendbuiltins.check
@@ -0,0 +1 @@
+10! = 3628800
diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala
new file mode 100644
index 0000000000..57acd699ff
--- /dev/null
+++ b/test/files/run/reify_extendbuiltins.scala
@@ -0,0 +1,21 @@
+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 fact(n: Int): BigInt =
+ if (n == 0) 1 else fact(n-1) * n
+ class Factorizer(n: Int) {
+ def ! = fact(n)
+ }
+ implicit def int2fact(n: Int) = new Factorizer(n)
+
+ println("10! = " + (10!))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_generic2.check b/test/files/run/reify_generic2.check
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/test/files/run/reify_generic2.check
@@ -0,0 +1 @@
+4
diff --git a/test/files/run/reify_generic2.scala b/test/files/run/reify_generic2.scala
new file mode 100644
index 0000000000..d03fe7602b
--- /dev/null
+++ b/test/files/run/reify_generic2.scala
@@ -0,0 +1,16 @@
+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 C
+ val product = List(new C, new C).length * List[C](new C, new C).length
+ println(product)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_getter.check b/test/files/run/reify_getter.check
new file mode 100644
index 0000000000..5ef4ff4d04
--- /dev/null
+++ b/test/files/run/reify_getter.check
@@ -0,0 +1 @@
+evaluated = 2
diff --git a/test/files/run/reify_getter.scala b/test/files/run/reify_getter.scala
new file mode 100644
index 0000000000..83eaded506
--- /dev/null
+++ b/test/files/run/reify_getter.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{
+ class C {
+ val x = 2
+ }
+
+ new 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/files/run/reify_implicits.check b/test/files/run/reify_implicits.check
new file mode 100644
index 0000000000..e3aeb20f6b
--- /dev/null
+++ b/test/files/run/reify_implicits.check
@@ -0,0 +1 @@
+x = List(1, 2, 3, 4)
diff --git a/test/files/run/reify_implicits.scala b/test/files/run/reify_implicits.scala
new file mode 100644
index 0000000000..a15cef9c97
--- /dev/null
+++ b/test/files/run/reify_implicits.scala
@@ -0,0 +1,21 @@
+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{
+ implicit def arrayWrapper[A : ClassManifest](x: Array[A]) =
+ new {
+ def sort(p: (A, A) => Boolean) = {
+ util.Sorting.stableSort(x, p); x
+ }
+ }
+ val x = Array(2, 3, 1, 4)
+ println("x = "+ x.sort((x: Int, y: Int) => x < y).toList)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_sort.check b/test/files/run/reify_sort.check
new file mode 100644
index 0000000000..375536cc29
--- /dev/null
+++ b/test/files/run/reify_sort.check
@@ -0,0 +1,2 @@
+[6,2,8,5,1]
+[1,2,5,6,8]
diff --git a/test/files/run/reify_sort.scala b/test/files/run/reify_sort.scala
new file mode 100644
index 0000000000..42991fe5d2
--- /dev/null
+++ b/test/files/run/reify_sort.scala
@@ -0,0 +1,57 @@
+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{
+ /** Nested methods can use and even update everything
+ * visible in their scope (including local variables or
+ * arguments of enclosing methods).
+ */
+ def sort(a: Array[Int]) {
+
+ def swap(i: Int, j: Int) {
+ val t = a(i); a(i) = a(j); a(j) = t
+ }
+
+ def sort1(l: Int, r: Int) {
+ val pivot = a((l + r) / 2)
+ var i = l
+ var j = r
+ while (i <= j) {
+ while (a(i) < pivot) i += 1
+ while (a(j) > pivot) j -= 1
+ if (i <= j) {
+ swap(i, j)
+ i += 1
+ j -= 1
+ }
+ }
+ if (l < j) sort1(l, j)
+ if (j < r) sort1(i, r)
+ }
+
+ if (a.length > 0)
+ sort1(0, a.length - 1)
+ }
+
+ def println(ar: Array[Int]) {
+ def print1 = {
+ def iter(i: Int): String =
+ ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "")
+ if (ar.length == 0) "" else iter(0)
+ }
+ Console.println("[" + print1 + "]")
+ }
+
+ val ar = Array(6, 2, 8, 5, 1)
+ println(ar)
+ sort(ar)
+ println(ar)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_sort1.check b/test/files/run/reify_sort1.check
new file mode 100644
index 0000000000..0d30805141
--- /dev/null
+++ b/test/files/run/reify_sort1.check
@@ -0,0 +1,2 @@
+List(6, 2, 8, 5, 1)
+List(1, 2, 5, 6, 8)
diff --git a/test/files/run/reify_sort1.scala b/test/files/run/reify_sort1.scala
new file mode 100644
index 0000000000..42f4c824a5
--- /dev/null
+++ b/test/files/run/reify_sort1.scala
@@ -0,0 +1,27 @@
+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 sort(a: List[Int]): List[Int] = {
+ if (a.length < 2)
+ a
+ else {
+ val pivot = a(a.length / 2)
+ sort(a.filter(_ < pivot)) :::
+ a.filter(_ == pivot) :::
+ sort(a.filter(_ > pivot))
+ }
+ }
+
+ val xs = List(6, 2, 8, 5, 1)
+ println(xs)
+ println(sort(xs))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/reify_this.check b/test/files/run/reify_this.check
new file mode 100644
index 0000000000..af3d0652a9
--- /dev/null
+++ b/test/files/run/reify_this.check
@@ -0,0 +1,5 @@
+foo
+false
+2
+bar
+2 \ No newline at end of file
diff --git a/test/files/run/reify_this.scala b/test/files/run/reify_this.scala
new file mode 100644
index 0000000000..38ef72b6eb
--- /dev/null
+++ b/test/files/run/reify_this.scala
@@ -0,0 +1,31 @@
+import scala.reflect._
+import scala.reflect.Code._
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import reflect.runtime.Mirror.ToolBox
+
+trait Eval {
+ def eval(code: Code[_]): Any = eval(code.tree)
+
+ def eval(tree: Tree): Any = {
+ val settings = new Settings
+ val reporter = new ConsoleReporter(settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(tree)
+ toolbox.runExpr(ttree)
+ }
+}
+
+object Test extends App with Eval {
+ // select a value from package
+ eval(lift{println("foo")})
+ eval(lift{println((new Object).toString == (new Object).toString)})
+
+ // select a type from package
+ eval(lift{val x: Any = 2; println(x)})
+ eval(lift{val x: Object = "bar"; println(x)})
+
+ // select a value from module
+ val x = 2
+ eval(lift{println(x)})
+}
diff --git a/test/files/run/t5256a.check b/test/files/run/t5256a.check
new file mode 100644
index 0000000000..304f4ddd79
--- /dev/null
+++ b/test/files/run/t5256a.check
@@ -0,0 +1,2 @@
+A
+true
diff --git a/test/files/run/t5256a.scala b/test/files/run/t5256a.scala
new file mode 100644
index 0000000000..05a935c770
--- /dev/null
+++ b/test/files/run/t5256a.scala
@@ -0,0 +1,9 @@
+import scala.reflect.mirror._
+
+class A
+
+object Test extends App {
+ val c = classToType(classOf[A])
+ println(c)
+ println(c.typeSymbol == classToSymbol(classOf[A]))
+}
diff --git a/test/files/run/t5256b.check b/test/files/run/t5256b.check
new file mode 100644
index 0000000000..64f4c01166
--- /dev/null
+++ b/test/files/run/t5256b.check
@@ -0,0 +1,2 @@
+Test.A
+true \ No newline at end of file
diff --git a/test/files/run/t5256b.scala b/test/files/run/t5256b.scala
new file mode 100644
index 0000000000..5575211641
--- /dev/null
+++ b/test/files/run/t5256b.scala
@@ -0,0 +1,8 @@
+import scala.reflect.mirror._
+
+object Test extends App {
+ class A
+ val c = classToType(classOf[A])
+ println(c)
+ println(c.typeSymbol == classToSymbol(classOf[A]))
+}
diff --git a/test/files/run/t5256d.check b/test/files/run/t5256d.check
new file mode 100644
index 0000000000..7924c15c5c
--- /dev/null
+++ b/test/files/run/t5256d.check
@@ -0,0 +1,20 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala>
+
+scala> import scala.reflect.mirror._
+import scala.reflect.mirror._
+
+scala> class A
+defined class A
+
+scala> val c = classToType(classOf[A])
+c: reflect.mirror.Type = A
+
+scala> println(c.typeSymbol == classToSymbol(classOf[A]))
+true
+
+scala>
+
+scala>
diff --git a/test/files/run/t5256d.scala b/test/files/run/t5256d.scala
new file mode 100644
index 0000000000..86404a9b63
--- /dev/null
+++ b/test/files/run/t5256d.scala
@@ -0,0 +1,10 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+import scala.reflect.mirror._
+class A
+val c = classToType(classOf[A])
+println(c.typeSymbol == classToSymbol(classOf[A]))
+ """
+}
diff --git a/test/files/run/t5256e.check b/test/files/run/t5256e.check
new file mode 100644
index 0000000000..e50f917e14
--- /dev/null
+++ b/test/files/run/t5256e.check
@@ -0,0 +1,2 @@
+C.this.A
+true \ No newline at end of file
diff --git a/test/files/run/t5256e.scala b/test/files/run/t5256e.scala
new file mode 100644
index 0000000000..9ed422ca44
--- /dev/null
+++ b/test/files/run/t5256e.scala
@@ -0,0 +1,9 @@
+import scala.reflect.mirror._
+
+class C { class A }
+
+object Test extends App {
+ val c = classToType(classOf[C#A])
+ println(c)
+ println(c.typeSymbol == classToSymbol(classOf[C#A]))
+}
diff --git a/test/files/run/t5256f.check b/test/files/run/t5256f.check
new file mode 100644
index 0000000000..ad2f375d9a
--- /dev/null
+++ b/test/files/run/t5256f.check
@@ -0,0 +1,4 @@
+Test.A1
+true
+Test.this.A2
+true
diff --git a/test/files/run/t5256f.scala b/test/files/run/t5256f.scala
new file mode 100644
index 0000000000..45c80cbd63
--- /dev/null
+++ b/test/files/run/t5256f.scala
@@ -0,0 +1,19 @@
+import scala.reflect.mirror._
+
+object Test extends App {
+ class A1
+
+ val c1 = classToType(classOf[A1])
+ println(c1)
+ println(c1.typeSymbol == classToSymbol(classOf[A1]))
+
+ new Test
+}
+
+class Test {
+ class A2
+
+ val c2 = classToType(classOf[A2])
+ println(c2)
+ println(c2.typeSymbol == classToSymbol(classOf[A2]))
+}
diff --git a/test/files/run/t5258a.check b/test/files/run/t5258a.check
new file mode 100644
index 0000000000..4e0b2da04c
--- /dev/null
+++ b/test/files/run/t5258a.check
@@ -0,0 +1 @@
+int \ No newline at end of file
diff --git a/test/files/run/t5258a.scala b/test/files/run/t5258a.scala
new file mode 100644
index 0000000000..deabb8310f
--- /dev/null
+++ b/test/files/run/t5258a.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{
+ println(classOf[Int])
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+} \ No newline at end of file
diff --git a/test/files/run/t5269.check b/test/files/run/t5269.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t5269.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t5269.scala b/test/files/run/t5269.scala
new file mode 100644
index 0000000000..a30509f3fe
--- /dev/null
+++ b/test/files/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/files/run/t5274_1.check b/test/files/run/t5274_1.check
new file mode 100644
index 0000000000..fca8bc3d3e
--- /dev/null
+++ b/test/files/run/t5274_1.check
@@ -0,0 +1,3 @@
+50! = 30414093201713378043612608166064768844377641568960512000000000000
+49! = 608281864034267560872252163321295376887552831379210240000000000
+50!/49! = 50
diff --git a/test/files/run/t5274_1.scala b/test/files/run/t5274_1.scala
new file mode 100644
index 0000000000..c501172518
--- /dev/null
+++ b/test/files/run/t5274_1.scala
@@ -0,0 +1,20 @@
+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 factorial(n: BigInt): BigInt =
+ if (n == 0) 1 else n * factorial(n-1)
+
+ val f50 = factorial(50); val f49 = factorial(49)
+ println("50! = " + f50)
+ println("49! = " + f49)
+ println("50!/49! = " + (f50 / f49))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5274_2.check b/test/files/run/t5274_2.check
new file mode 100644
index 0000000000..375536cc29
--- /dev/null
+++ b/test/files/run/t5274_2.check
@@ -0,0 +1,2 @@
+[6,2,8,5,1]
+[1,2,5,6,8]
diff --git a/test/files/run/t5274_2.scala b/test/files/run/t5274_2.scala
new file mode 100644
index 0000000000..42991fe5d2
--- /dev/null
+++ b/test/files/run/t5274_2.scala
@@ -0,0 +1,57 @@
+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{
+ /** Nested methods can use and even update everything
+ * visible in their scope (including local variables or
+ * arguments of enclosing methods).
+ */
+ def sort(a: Array[Int]) {
+
+ def swap(i: Int, j: Int) {
+ val t = a(i); a(i) = a(j); a(j) = t
+ }
+
+ def sort1(l: Int, r: Int) {
+ val pivot = a((l + r) / 2)
+ var i = l
+ var j = r
+ while (i <= j) {
+ while (a(i) < pivot) i += 1
+ while (a(j) > pivot) j -= 1
+ if (i <= j) {
+ swap(i, j)
+ i += 1
+ j -= 1
+ }
+ }
+ if (l < j) sort1(l, j)
+ if (j < r) sort1(i, r)
+ }
+
+ if (a.length > 0)
+ sort1(0, a.length - 1)
+ }
+
+ def println(ar: Array[Int]) {
+ def print1 = {
+ def iter(i: Int): String =
+ ar(i) + (if (i < ar.length-1) "," + iter(i+1) else "")
+ if (ar.length == 0) "" else iter(0)
+ }
+ Console.println("[" + print1 + "]")
+ }
+
+ val ar = Array(6, 2, 8, 5, 1)
+ println(ar)
+ sort(ar)
+ println(ar)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5275.check b/test/files/run/t5275.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t5275.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t5275.scala b/test/files/run/t5275.scala
new file mode 100644
index 0000000000..d419834ded
--- /dev/null
+++ b/test/files/run/t5275.scala
@@ -0,0 +1,15 @@
+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 C(val foo: Int)
+ println(new C(2).foo)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5277_1.check b/test/files/run/t5277_1.check
new file mode 100644
index 0000000000..a48033a30d
--- /dev/null
+++ b/test/files/run/t5277_1.check
@@ -0,0 +1 @@
+10! = 3628800
diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala
new file mode 100644
index 0000000000..57acd699ff
--- /dev/null
+++ b/test/files/run/t5277_1.scala
@@ -0,0 +1,21 @@
+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 fact(n: Int): BigInt =
+ if (n == 0) 1 else fact(n-1) * n
+ class Factorizer(n: Int) {
+ def ! = fact(n)
+ }
+ implicit def int2fact(n: Int) = new Factorizer(n)
+
+ println("10! = " + (10!))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5277_2.check b/test/files/run/t5277_2.check
new file mode 100644
index 0000000000..ca017e2a40
--- /dev/null
+++ b/test/files/run/t5277_2.check
@@ -0,0 +1,2 @@
+2()
+1()
diff --git a/test/files/run/t5277_2.scala b/test/files/run/t5277_2.scala
new file mode 100644
index 0000000000..67b6b000bc
--- /dev/null
+++ b/test/files/run/t5277_2.scala
@@ -0,0 +1,18 @@
+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 p(implicit i: Int) = print(i)
+ implicit val v = 2
+
+ println(p)
+ println(p(1))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5279.check b/test/files/run/t5279.check
new file mode 100644
index 0000000000..f599e28b8a
--- /dev/null
+++ b/test/files/run/t5279.check
@@ -0,0 +1 @@
+10
diff --git a/test/files/run/t5279.scala b/test/files/run/t5279.scala
new file mode 100644
index 0000000000..39e7dd2c66
--- /dev/null
+++ b/test/files/run/t5279.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{
+ println(new Integer(10))
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5335.check b/test/files/run/t5335.check
new file mode 100644
index 0000000000..0cfbf08886
--- /dev/null
+++ b/test/files/run/t5335.check
@@ -0,0 +1 @@
+2
diff --git a/test/files/run/t5335.scala b/test/files/run/t5335.scala
new file mode 100644
index 0000000000..9a8b91f04d
--- /dev/null
+++ b/test/files/run/t5335.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{
+ println(new {def x = 2}.x)
+ };
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+ toolbox.runExpr(ttree)
+}
diff --git a/test/files/run/t5415.check b/test/files/run/t5415.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/run/t5415.check
diff --git a/test/files/run/t5415.scala b/test/files/run/t5415.scala
new file mode 100644
index 0000000000..3db356da86
--- /dev/null
+++ b/test/files/run/t5415.scala
@@ -0,0 +1,14 @@
+import scala.tools.nsc.reporters._
+import scala.tools.nsc.Settings
+import scala.reflect.runtime.Mirror.ToolBox
+
+object Test extends App{
+ case class Queryable2[T]() { def filter(predicate: T => Boolean) = ??? }
+ trait CoffeesTable{ def sales : Int }
+ val q = Queryable2[CoffeesTable]()
+ val code = scala.reflect.Code.lift{q.filter(_.sales > 5)}
+
+ val reporter = new ConsoleReporter(new Settings)
+ val toolbox = new ToolBox(reporter)
+ val ttree = toolbox.typeCheck(code.tree)
+}
diff --git a/test/files/run/t5423.check b/test/files/run/t5423.check
new file mode 100644
index 0000000000..ae3d3fb82b
--- /dev/null
+++ b/test/files/run/t5423.check
@@ -0,0 +1 @@
+List(table) \ No newline at end of file
diff --git a/test/files/run/t5423.scala b/test/files/run/t5423.scala
new file mode 100644
index 0000000000..2139773ff1
--- /dev/null
+++ b/test/files/run/t5423.scala
@@ -0,0 +1,12 @@
+import java.lang.Class
+import scala.reflect.mirror._
+import scala.reflect.runtime.Mirror.ToolBox
+import scala.reflect.Code
+
+final class table extends StaticAnnotation
+@table class A
+
+object Test extends App{
+ val s = classToSymbol(classOf[A])
+ println(s.getAnnotations)
+}
diff --git a/test/files/run/virtpatmat_staging.check b/test/files/run/virtpatmat_staging.check
new file mode 100644
index 0000000000..106ae40b99
--- /dev/null
+++ b/test/files/run/virtpatmat_staging.check
@@ -0,0 +1 @@
+runOrElse(7, ?guard(false,?).flatMap(? =>one(foo)).orElse(one(bar)))
diff --git a/test/files/run/virtpatmat_staging.flags b/test/files/run/virtpatmat_staging.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/run/virtpatmat_staging.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/run/virtpatmat_staging.scala b/test/files/run/virtpatmat_staging.scala
new file mode 100644
index 0000000000..c17b45043b
--- /dev/null
+++ b/test/files/run/virtpatmat_staging.scala
@@ -0,0 +1,52 @@
+trait Intf {
+ type Rep[+T]
+ type M[+T] = Rep[Maybe[T]]
+
+ val __match: Matcher
+ abstract class Matcher {
+ // runs the matcher on the given input
+ def runOrElse[T, U](in: Rep[T])(matcher: Rep[T] => M[U]): Rep[U]
+
+ def zero: M[Nothing]
+ def one[T](x: Rep[T]): M[T]
+ def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T]
+ def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] // used for isDefinedAt
+ }
+
+ abstract class Maybe[+A] {
+ def flatMap[B](f: Rep[A] => M[B]): M[B]
+ def orElse[B >: A](alternative: => M[B]): M[B]
+ }
+
+ implicit def proxyMaybe[A](m: M[A]): Maybe[A]
+ implicit def repInt(x: Int): Rep[Int]
+ implicit def repBoolean(x: Boolean): Rep[Boolean]
+ implicit def repString(x: String): Rep[String]
+
+ def test = 7 match { case 5 => "foo" case _ => "bar" }
+}
+
+trait Impl extends Intf {
+ type Rep[+T] = String
+
+ object __match extends Matcher {
+ def runOrElse[T, U](in: Rep[T])(matcher: Rep[T] => M[U]): Rep[U] = ("runOrElse("+ in +", ?" + matcher("?") + ")")
+ def zero: M[Nothing] = "zero"
+ def one[T](x: Rep[T]): M[T] = "one("+x.toString+")"
+ def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T] = "guard("+cond+","+then+")"
+ def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] = ("isSuccess("+x+", ?" + f("?") + ")")
+ }
+
+ implicit def proxyMaybe[A](m: M[A]): Maybe[A] = new Maybe[A] {
+ def flatMap[B](f: Rep[A] => M[B]): M[B] = m + ".flatMap(? =>"+ f("?") +")"
+ def orElse[B >: A](alternative: => M[B]): M[B] = m + ".orElse("+ alternative +")"
+ }
+
+ def repInt(x: Int): Rep[Int] = x.toString
+ def repBoolean(x: Boolean): Rep[Boolean] = x.toString
+ def repString(x: String): Rep[String] = x
+}
+
+object Test extends Impl with Intf with App {
+ println(test)
+}
diff --git a/test/files/run/virtpatmat_switch.check b/test/files/run/virtpatmat_switch.check
new file mode 100644
index 0000000000..6ded95c010
--- /dev/null
+++ b/test/files/run/virtpatmat_switch.check
@@ -0,0 +1,7 @@
+zero
+one
+many
+got a
+got b
+got some letter
+scala.MatchError: 5 (of class java.lang.Integer) \ No newline at end of file
diff --git a/test/files/run/virtpatmat_switch.flags b/test/files/run/virtpatmat_switch.flags
new file mode 100644
index 0000000000..9769db9257
--- /dev/null
+++ b/test/files/run/virtpatmat_switch.flags
@@ -0,0 +1 @@
+ -Yvirtpatmat -Xexperimental
diff --git a/test/files/run/virtpatmat_switch.scala b/test/files/run/virtpatmat_switch.scala
new file mode 100644
index 0000000000..2e2c31e8e5
--- /dev/null
+++ b/test/files/run/virtpatmat_switch.scala
@@ -0,0 +1,32 @@
+object Test extends App {
+ def intSwitch(x: Int) = x match {
+ case 0 => "zero"
+ case 1 => "one"
+ case _ => "many"
+ }
+
+ println(intSwitch(0))
+ println(intSwitch(1))
+ println(intSwitch(10))
+
+ def charSwitch(x: Char) = x match {
+ case 'a' => "got a"
+ case 'b' => "got b"
+ case _ => "got some letter"
+ }
+
+ println(charSwitch('a'))
+ println(charSwitch('b'))
+ println(charSwitch('z'))
+
+ def implicitDefault(x: Int) = x match {
+ case 0 => 0
+ }
+
+ try {
+ implicitDefault(5)
+ } catch {
+ case e: MatchError => println(e)
+ }
+
+}