summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-05-08 11:00:40 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-05-08 13:59:42 +0200
commit81f79a0165f4e49c6d28f7ec147d6b37e309ee6a (patch)
tree519afbf4608ad9f533f8f8a462606ca79142bd8a /test/files/run
parent9ad96d07ee9d1ef1a9a072873711ff911caafc71 (diff)
parent876590b2be42a77fc23e5c57fc155d5772265be7 (diff)
downloadscala-81f79a0165f4e49c6d28f7ec147d6b37e309ee6a.tar.gz
scala-81f79a0165f4e49c6d28f7ec147d6b37e309ee6a.tar.bz2
scala-81f79a0165f4e49c6d28f7ec147d6b37e309ee6a.zip
Merge commit '876590b' into topic/merge-2.10.x
Conflicts: bincompat-forward.whitelist.conf src/reflect/scala/reflect/runtime/JavaMirrors.scala
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t8196.check7
-rw-r--r--test/files/run/t8196.scala51
2 files changed, 58 insertions, 0 deletions
diff --git a/test/files/run/t8196.check b/test/files/run/t8196.check
new file mode 100644
index 0000000000..b32f42cf07
--- /dev/null
+++ b/test/files/run/t8196.check
@@ -0,0 +1,7 @@
+t8196.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses
+ form2.g1 // comment this line in order to make the test pass
+ ^
+warning: there were 2 feature warning(s); re-run with -feature for details
+Scope{
+ final private val f1: Int
+}
diff --git a/test/files/run/t8196.scala b/test/files/run/t8196.scala
new file mode 100644
index 0000000000..e219ac166b
--- /dev/null
+++ b/test/files/run/t8196.scala
@@ -0,0 +1,51 @@
+import scala.reflect.runtime.{ universe => ru }
+
+object Test extends App {
+
+ trait FormTrait {
+
+ val runtimeMirror = ru.runtimeMirror(this.getClass.getClassLoader)
+ val instanceMirror = runtimeMirror.reflect(this)
+ val members = instanceMirror.symbol.typeSignature.members
+ def fields = members.filter(_.typeSignature <:< ru.typeOf[Int])
+ }
+
+ val f = () => {
+
+ class Form1 extends FormTrait {
+ val f1 = 5
+ }
+ val form1 = new Form1
+
+ println(form1.fields)
+
+ val form2 = new FormTrait {
+ val g1 = new Form1
+ }
+
+ form2.g1 // comment this line in order to make the test pass
+ ()
+ }
+
+ val g = () => {
+ // Reported as SI-8195, same root cause
+ trait Form {
+
+ private val runtimeMirror = ru.runtimeMirror(this.getClass.getClassLoader)
+ private val instanceMirror = runtimeMirror.reflect(this)
+ private val members = instanceMirror.symbol.typeSignature.members
+
+ }
+
+ val f1 = new Form {
+ val a = 1
+ }
+
+ val f2 = new Form {
+ val b = f1.a
+ }
+ }
+
+ f()
+ g()
+}