summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-11-16 01:47:03 +0100
committerSimon Ochsenreither <simon@ochsenreither.de>2014-01-03 03:07:12 +0100
commit2e7c7347b9b89a2aac2f6abbea9f9f0815c18761 (patch)
treeac4526cdfe78f0c8b60e2ce9703a5078ff3b3d9b /test
parent5e1e472fa10145606fbe3ff2966c35e2842d3894 (diff)
downloadscala-2e7c7347b9b89a2aac2f6abbea9f9f0815c18761.tar.gz
scala-2e7c7347b9b89a2aac2f6abbea9f9f0815c18761.tar.bz2
scala-2e7c7347b9b89a2aac2f6abbea9f9f0815c18761.zip
SI-7974 Clean up and test 'Symbol-handling code in CleanUp
Looks like the transformation did never happen because the pattern failed to match. Why did the pattern fail to match? Because the Symbol.apply we see in the tree claims to be a method while Symbol_apply defined in Definitions wants to be a value. This issue was caused because nonPrivateMember starts spitting out overloaded symbols after erasure. This issue has been fixed in the earlier commit, so what happens in this commit is adding tests and fixing documentation.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t7974.check104
-rw-r--r--test/files/run/t7974/Symbols.scala6
-rw-r--r--test/files/run/t7974/Test.scala20
3 files changed, 130 insertions, 0 deletions
diff --git a/test/files/run/t7974.check b/test/files/run/t7974.check
new file mode 100644
index 0000000000..0be496d8d0
--- /dev/null
+++ b/test/files/run/t7974.check
@@ -0,0 +1,104 @@
+public class Symbols {
+
+ // compiled from: Symbols.scala
+
+
+
+ // access flags 0x12
+ private final Lscala/Symbol; someSymbol3
+
+ // access flags 0xA
+ private static Lscala/Symbol; symbol$1
+
+ // access flags 0xA
+ private static Lscala/Symbol; symbol$2
+
+ // access flags 0xA
+ private static Lscala/Symbol; symbol$3
+
+ // access flags 0x9
+ public static <clinit>()V
+ L0
+ LINENUMBER 2 L0
+ GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$;
+ LDC "Symbolic1"
+ INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol;
+ PUTSTATIC Symbols.symbol$1 : Lscala/Symbol;
+ L1
+ LINENUMBER 3 L1
+ GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$;
+ LDC "Symbolic2"
+ INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol;
+ PUTSTATIC Symbols.symbol$2 : Lscala/Symbol;
+ L2
+ LINENUMBER 5 L2
+ GETSTATIC scala/Symbol$.MODULE$ : Lscala/Symbol$;
+ LDC "Symbolic3"
+ INVOKEVIRTUAL scala/Symbol$.apply (Ljava/lang/String;)Lscala/Symbol;
+ PUTSTATIC Symbols.symbol$3 : Lscala/Symbol;
+ RETURN
+ MAXSTACK = 2
+ MAXLOCALS = 0
+
+ // access flags 0x1
+ public someSymbol1()Lscala/Symbol;
+ L0
+ LINENUMBER 2 L0
+ GETSTATIC Symbols.symbol$1 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public someSymbol2()Lscala/Symbol;
+ L0
+ LINENUMBER 3 L0
+ GETSTATIC Symbols.symbol$2 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public sameSymbol1()Lscala/Symbol;
+ L0
+ LINENUMBER 4 L0
+ GETSTATIC Symbols.symbol$1 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public someSymbol3()Lscala/Symbol;
+ L0
+ LINENUMBER 5 L0
+ ALOAD 0
+ GETFIELD Symbols.someSymbol3 : Lscala/Symbol;
+ ARETURN
+ L1
+ LOCALVARIABLE this LSymbols; L0 L1 0
+ MAXSTACK = 1
+ MAXLOCALS = 1
+
+ // access flags 0x1
+ public <init>()V
+ L0
+ LINENUMBER 6 L0
+ ALOAD 0
+ INVOKESPECIAL java/lang/Object.<init> ()V
+ L1
+ LINENUMBER 5 L1
+ ALOAD 0
+ GETSTATIC Symbols.symbol$3 : Lscala/Symbol;
+ PUTFIELD Symbols.someSymbol3 : Lscala/Symbol;
+ RETURN
+ L2
+ LOCALVARIABLE this LSymbols; L0 L2 0
+ MAXSTACK = 2
+ MAXLOCALS = 1
+}
diff --git a/test/files/run/t7974/Symbols.scala b/test/files/run/t7974/Symbols.scala
new file mode 100644
index 0000000000..2363b724eb
--- /dev/null
+++ b/test/files/run/t7974/Symbols.scala
@@ -0,0 +1,6 @@
+class Symbols {
+ def someSymbol1 = 'Symbolic1
+ def someSymbol2 = 'Symbolic2
+ def sameSymbol1 = 'Symbolic1
+ val someSymbol3 = 'Symbolic3
+}
diff --git a/test/files/run/t7974/Test.scala b/test/files/run/t7974/Test.scala
new file mode 100644
index 0000000000..9403ea332b
--- /dev/null
+++ b/test/files/run/t7974/Test.scala
@@ -0,0 +1,20 @@
+import java.io.PrintWriter;
+
+import scala.tools.partest.BytecodeTest
+import scala.tools.asm.util._
+import scala.tools.nsc.util.stringFromWriter
+
+object Test extends BytecodeTest {
+ def show {
+ val classNode = loadClassNode("Symbols", skipDebugInfo = false)
+ val textifier = new Textifier
+ classNode.accept(new TraceClassVisitor(null, textifier, null))
+
+ val classString = stringFromWriter(w => textifier.print(w))
+ val result =
+ classString.split('\n')
+ .dropWhile(elem => elem != "public class Symbols {")
+ .filterNot(elem => elem.startsWith(" @Lscala/reflect/ScalaSignature") || elem.startsWith(" ATTRIBUTE ScalaSig"))
+ result foreach println
+ }
+}