summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-02-08 07:35:28 -0800
committerJames Iry <jamesiry@gmail.com>2013-02-08 07:35:28 -0800
commit3b6300b14b8aaac4c6bb7c70b51ef1df3dc3c536 (patch)
treea61374b070df32a04643be7d2ac348034d8cdf77 /test/files/run
parentc0d1bc4cc4cb2958af69305d286ff684306617a5 (diff)
parent5258b63740c9fb1be3c531e1dc1399fb0dc55569 (diff)
downloadscala-3b6300b14b8aaac4c6bb7c70b51ef1df3dc3c536.tar.gz
scala-3b6300b14b8aaac4c6bb7c70b51ef1df3dc3c536.tar.bz2
scala-3b6300b14b8aaac4c6bb7c70b51ef1df3dc3c536.zip
Merge pull request #2092 from lrytz/t7096
SI-7096 SubstSymMap copies trees before modifying their symbols
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t7096.check2
-rw-r--r--test/files/run/t7096.scala36
2 files changed, 38 insertions, 0 deletions
diff --git a/test/files/run/t7096.check b/test/files/run/t7096.check
new file mode 100644
index 0000000000..6f1cef6c43
--- /dev/null
+++ b/test/files/run/t7096.check
@@ -0,0 +1,2 @@
+testing symbol List(method foo, class Base, package ano, package <root>), param value x, xRefs List(x)
+testing symbol List(method foo, class Sub, package ano, package <root>), param value x, xRefs List(x)
diff --git a/test/files/run/t7096.scala b/test/files/run/t7096.scala
new file mode 100644
index 0000000000..e9c0323c2e
--- /dev/null
+++ b/test/files/run/t7096.scala
@@ -0,0 +1,36 @@
+import scala.tools.partest._
+import scala.tools.nsc._
+
+object Test extends CompilerTest {
+ import global._
+ import definitions._
+
+ override def code = """
+package ano
+
+class ann(x: Any) extends annotation.TypeConstraint
+
+abstract class Base {
+ def foo(x: String): String @ann(x.trim())
+}
+
+class Sub extends Base {
+ def foo(x: String): String @ann(x.trim()) = x
+}
+ """
+
+ object syms extends SymsInPackage("ano")
+ import syms._
+
+ def check(source: String, unit: global.CompilationUnit) {
+ afterTyper {
+ terms.filter(_.name.toString == "foo").foreach(sym => {
+ val xParam = sym.tpe.paramss.flatten.head
+ val annot = sym.tpe.finalResultType.annotations.head
+ val xRefs = annot.args.head.filter(t => t.symbol == xParam)
+ println(s"testing symbol ${sym.ownerChain}, param $xParam, xRefs $xRefs")
+ assert(xRefs.length == 1, xRefs)
+ })
+ }
+ }
+}