summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/lib/macro210.jar.desired.sha11
-rw-r--r--test/files/neg/divergent-implicit.check6
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-a.check7
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-a/Macros_2.flags (renamed from test/files/neg/macro-incompatible-macro-engine/Macros_2.flags)0
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-a/Macros_2.scala (renamed from test/files/neg/macro-incompatible-macro-engine/Macros_2.scala)0
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-a/Plugin_1.scala (renamed from test/files/neg/macro-incompatible-macro-engine/Plugin_1.scala)0
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-a/Test_3.scala (renamed from test/files/neg/macro-incompatible-macro-engine/Test_3.scala)0
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml (renamed from test/files/neg/macro-incompatible-macro-engine/scalac-plugin.xml)0
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b.check7
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b.flags1
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b/Macros_2.flags1
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b/Macros_2.scala7
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b/Plugin_1.scala35
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b/Test_3.scala4
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml4
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-c.check4
-rw-r--r--test/files/neg/macro-incompatible-macro-engine-c.scala3
-rw-r--r--test/files/neg/macro-incompatible-macro-engine.check7
-rw-r--r--test/files/neg/quasiquotes-syntax-error-position.check14
-rw-r--r--test/files/neg/quasiquotes-syntax-error-position.scala5
-rw-r--r--test/files/neg/t4728.check7
-rw-r--r--test/files/neg/t4728.scala (renamed from test/pending/run/t4728.scala)0
-rw-r--r--test/files/neg/t5148.check8
-rw-r--r--test/files/neg/t6988.check7
-rw-r--r--test/files/neg/t6988.scala10
-rw-r--r--test/files/neg/t8265.check6
-rw-r--r--test/files/neg/t8265.flags1
-rw-r--r--test/files/neg/t8265.scala1
-rw-r--r--test/files/neg/t8325-b.check10
-rw-r--r--test/files/neg/t8325-b.scala4
-rw-r--r--test/files/neg/t8325-c.check7
-rw-r--r--test/files/neg/t8325-c.scala4
-rw-r--r--test/files/neg/t8325.check15
-rw-r--r--test/files/neg/t8325.scala11
-rw-r--r--test/files/neg/t8372.check7
-rw-r--r--test/files/neg/t8372.scala10
-rw-r--r--test/files/neg/t8376.check7
-rw-r--r--test/files/neg/t8376/J.java4
-rw-r--r--test/files/neg/t8376/S.scala4
-rw-r--r--test/files/neg/t8430.check27
-rw-r--r--test/files/neg/t8430.flags1
-rw-r--r--test/files/neg/t8430.scala32
-rw-r--r--test/files/neg/t8431.check27
-rw-r--r--test/files/neg/t8431.scala63
-rw-r--r--test/files/neg/t8450.check6
-rw-r--r--test/files/neg/t8450.flags1
-rw-r--r--test/files/neg/t8450.scala12
-rw-r--r--test/files/neg/t8463.check10
-rw-r--r--test/files/neg/t8463.scala38
-rw-r--r--test/files/pos/t8157-2.10.flags1
-rw-r--r--test/files/pos/t8157-2.10.scala5
-rw-r--r--test/files/pos/t8325.scala9
-rw-r--r--test/files/pos/t8329.scala29
-rw-r--r--test/files/pos/t8352.check0
-rw-r--r--test/files/pos/t8352/Macros_1.scala7
-rw-r--r--test/files/pos/t8352/Test_2.scala5
-rw-r--r--test/files/pos/t8363.flags1
-rw-r--r--test/files/pos/t8363.scala7
-rw-r--r--test/files/pos/t8364.check0
-rw-r--r--test/files/pos/t8364.scala12
-rw-r--r--test/files/pos/t8367.scala11
-rw-r--r--test/files/pos/t8369a.check0
-rw-r--r--test/files/pos/t8369a.scala5
-rw-r--r--test/files/pos/t8369b.check0
-rw-r--r--test/files/pos/t8369b.scala18
-rw-r--r--test/files/pos/t8376/BindingsX.java13
-rw-r--r--test/files/pos/t8376/Test.scala10
-rw-r--r--test/files/pos/t8403.scala9
-rw-r--r--test/files/pos/t8411/Macros_1.scala10
-rw-r--r--test/files/pos/t8411/Test_2.scala4
-rw-r--r--test/files/pos/t8460.scala25
-rw-r--r--test/files/pos/t8497/A_1.scala13
-rw-r--r--test/files/pos/t8497/B_2.scala1
-rw-r--r--test/files/pos/t8523.flags1
-rw-r--r--test/files/pos/t8523.scala10
-rw-r--r--test/files/run/mirror_symbolof_x.check13
-rw-r--r--test/files/run/mirror_symbolof_x.scala43
-rw-r--r--test/files/run/t6196.scala2
-rw-r--r--test/files/run/t6200.scala2
-rw-r--r--test/files/run/t6392b.check2
-rw-r--r--test/files/run/t6440.check8
-rw-r--r--test/files/run/t6440b.check8
-rw-r--r--test/files/run/t6988.check2
-rw-r--r--test/files/run/t6988.scala9
-rw-r--r--test/files/run/t7582-private-within.check2
-rw-r--r--test/files/run/t7992.scala20
-rw-r--r--test/files/run/t7992b.scala18
-rw-r--r--test/files/run/t8192.check12
-rw-r--r--test/files/run/t8192/Macros_1.scala3
-rw-r--r--test/files/run/t8192/Test_2.scala3
-rw-r--r--test/files/run/t8197.scala7
-rw-r--r--test/files/run/t8266-octal-interp.check2
-rw-r--r--test/files/run/t8395.scala9
-rw-r--r--test/files/run/t8425.check1
-rw-r--r--test/files/run/t8425/Macros_1.scala12
-rw-r--r--test/files/run/t8425/Test_2.scala3
-rw-r--r--test/files/run/t8428.scala12
-rw-r--r--test/files/run/t8437.check2
-rw-r--r--test/files/run/t8437/Macros_1.scala18
-rw-r--r--test/files/run/t8437/Test_2.scala4
-rw-r--r--test/files/run/t8549.check1
-rw-r--r--test/files/run/t8549.scala175
-rw-r--r--test/files/run/t8549b.scala16
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala20
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala20
-rw-r--r--test/files/scalacheck/quasiquotes/ErrorProps.scala56
-rw-r--r--test/files/scalacheck/quasiquotes/LiftableProps.scala15
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala46
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala71
-rw-r--r--test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala12
-rw-r--r--test/files/scalacheck/quasiquotes/TypecheckedProps.scala104
-rw-r--r--test/files/scalacheck/quasiquotes/UnliftableProps.scala8
-rw-r--r--test/junit/scala/collection/convert/MapWrapperTest.scala10
-rw-r--r--test/junit/scala/reflect/internal/MirrorsTest.scala36
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala1966
-rw-r--r--test/pending/pos/t8363b.scala7
-rw-r--r--test/pending/run/t4728.check2
-rw-r--r--test/scaladoc/resources/SI-8144.scala17
-rw-r--r--test/scaladoc/resources/SI-8514.scala10
-rw-r--r--test/scaladoc/run/t8407.check4
-rw-r--r--test/scaladoc/run/t8407.scala20
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala80
122 files changed, 2642 insertions, 923 deletions
diff --git a/test/files/lib/macro210.jar.desired.sha1 b/test/files/lib/macro210.jar.desired.sha1
new file mode 100644
index 0000000000..ff87a55129
--- /dev/null
+++ b/test/files/lib/macro210.jar.desired.sha1
@@ -0,0 +1 @@
+3794ec22d9b27f2b179bd34e9b46db771b934ec3 ?macro210.jar
diff --git a/test/files/neg/divergent-implicit.check b/test/files/neg/divergent-implicit.check
index 60d876409f..d4a3ddfc71 100644
--- a/test/files/neg/divergent-implicit.check
+++ b/test/files/neg/divergent-implicit.check
@@ -3,6 +3,10 @@ divergent-implicit.scala:4: error: type mismatch;
required: String
val x1: String = 1
^
+divergent-implicit.scala:5: error: diverging implicit expansion for type Int => String
+starting with method $conforms in object Predef
+ val x2: String = cast[Int, String](1)
+ ^
divergent-implicit.scala:14: error: type mismatch;
found : Test2.Foo
required: Test2.Bar
@@ -13,4 +17,4 @@ divergent-implicit.scala:15: error: type mismatch;
required: Test2.Bar
val y: Bar = new Baz
^
-three errors found
+four errors found
diff --git a/test/files/neg/macro-incompatible-macro-engine-a.check b/test/files/neg/macro-incompatible-macro-engine-a.check
new file mode 100644
index 0000000000..8ae08bd164
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-a.check
@@ -0,0 +1,7 @@
+Test_3.scala:2: error: macro cannot be expanded, because it was compiled by an incompatible macro engine
+ Macros.foo
+ ^
+Test_3.scala:3: error: macro cannot be expanded, because it was compiled by an incompatible macro engine
+ Macros.foo
+ ^
+two errors found
diff --git a/test/files/neg/macro-incompatible-macro-engine/Macros_2.flags b/test/files/neg/macro-incompatible-macro-engine-a/Macros_2.flags
index 966df731d0..966df731d0 100644
--- a/test/files/neg/macro-incompatible-macro-engine/Macros_2.flags
+++ b/test/files/neg/macro-incompatible-macro-engine-a/Macros_2.flags
diff --git a/test/files/neg/macro-incompatible-macro-engine/Macros_2.scala b/test/files/neg/macro-incompatible-macro-engine-a/Macros_2.scala
index 39708eee49..39708eee49 100644
--- a/test/files/neg/macro-incompatible-macro-engine/Macros_2.scala
+++ b/test/files/neg/macro-incompatible-macro-engine-a/Macros_2.scala
diff --git a/test/files/neg/macro-incompatible-macro-engine/Plugin_1.scala b/test/files/neg/macro-incompatible-macro-engine-a/Plugin_1.scala
index 44ed91d2fb..44ed91d2fb 100644
--- a/test/files/neg/macro-incompatible-macro-engine/Plugin_1.scala
+++ b/test/files/neg/macro-incompatible-macro-engine-a/Plugin_1.scala
diff --git a/test/files/neg/macro-incompatible-macro-engine/Test_3.scala b/test/files/neg/macro-incompatible-macro-engine-a/Test_3.scala
index 7e4fae5236..7e4fae5236 100644
--- a/test/files/neg/macro-incompatible-macro-engine/Test_3.scala
+++ b/test/files/neg/macro-incompatible-macro-engine-a/Test_3.scala
diff --git a/test/files/neg/macro-incompatible-macro-engine/scalac-plugin.xml b/test/files/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml
index 42b9cdd75d..42b9cdd75d 100644
--- a/test/files/neg/macro-incompatible-macro-engine/scalac-plugin.xml
+++ b/test/files/neg/macro-incompatible-macro-engine-a/scalac-plugin.xml
diff --git a/test/files/neg/macro-incompatible-macro-engine-b.check b/test/files/neg/macro-incompatible-macro-engine-b.check
new file mode 100644
index 0000000000..2a7510cf86
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b.check
@@ -0,0 +1,7 @@
+Test_3.scala:2: error: macro cannot be expanded, because it was compiled by an incompatible macro engine (internal diagnostic: expected = v7.0 (implemented in Scala 2.11.0-M8), actual = vxxx (implemented in the incompatibleMacroEngine plugin))
+ Macros.foo
+ ^
+Test_3.scala:3: error: macro cannot be expanded, because it was compiled by an incompatible macro engine (internal diagnostic: expected = v7.0 (implemented in Scala 2.11.0-M8), actual = vxxx (implemented in the incompatibleMacroEngine plugin))
+ Macros.foo
+ ^
+two errors found
diff --git a/test/files/neg/macro-incompatible-macro-engine-b.flags b/test/files/neg/macro-incompatible-macro-engine-b.flags
new file mode 100644
index 0000000000..037a693bbd
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b.flags
@@ -0,0 +1 @@
+-Ymacro-debug-lite \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine-b/Macros_2.flags b/test/files/neg/macro-incompatible-macro-engine-b/Macros_2.flags
new file mode 100644
index 0000000000..966df731d0
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b/Macros_2.flags
@@ -0,0 +1 @@
+-Xplugin:. \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine-b/Macros_2.scala b/test/files/neg/macro-incompatible-macro-engine-b/Macros_2.scala
new file mode 100644
index 0000000000..39708eee49
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b/Macros_2.scala
@@ -0,0 +1,7 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def impl(c: Context) = c.universe.Literal(c.universe.Constant(()))
+ def foo: Unit = macro impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine-b/Plugin_1.scala b/test/files/neg/macro-incompatible-macro-engine-b/Plugin_1.scala
new file mode 100644
index 0000000000..44ed91d2fb
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b/Plugin_1.scala
@@ -0,0 +1,35 @@
+package incompatibleMacroEngine
+
+import scala.tools.nsc.Global
+import scala.tools.nsc.plugins.{Plugin => NscPlugin}
+
+class Plugin(val global: Global) extends NscPlugin {
+ import global._
+ import analyzer._
+
+ val name = "incompatibleMacroEngine"
+ val description = "A sample analyzer plugin that crafts a macro impl binding with a non-standard macro engine."
+ val components = Nil
+ addMacroPlugin(MacroPlugin)
+
+ object MacroPlugin extends MacroPlugin {
+ def fixupBinding(tree: Tree) = new Transformer {
+ override def transform(tree: Tree) = {
+ tree match {
+ case Literal(const @ Constant(x)) if tree.tpe == null => tree setType ConstantType(const)
+ case _ if tree.tpe == null => tree setType NoType
+ case _ => ;
+ }
+ super.transform(tree)
+ }
+ }.transform(tree)
+
+ override def pluginsTypedMacroBody(typer: Typer, ddef: DefDef): Option[Tree] = {
+ val result = standardTypedMacroBody(typer, ddef)
+ val List(AnnotationInfo(atp, List(Apply(nucleus, _ :: others)), Nil)) = ddef.symbol.annotations
+ val updatedBinding = Apply(nucleus, Assign(Literal(Constant("macroEngine")), Literal(Constant("vxxx (implemented in the incompatibleMacroEngine plugin)"))) :: others)
+ ddef.symbol.setAnnotations(List(AnnotationInfo(atp, List(fixupBinding(updatedBinding)), Nil)))
+ Some(result)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine-b/Test_3.scala b/test/files/neg/macro-incompatible-macro-engine-b/Test_3.scala
new file mode 100644
index 0000000000..7e4fae5236
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b/Test_3.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ Macros.foo
+ Macros.foo
+} \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml b/test/files/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml
new file mode 100644
index 0000000000..42b9cdd75d
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-b/scalac-plugin.xml
@@ -0,0 +1,4 @@
+<plugin>
+ <name>incompatible-macro-engine</name>
+ <classname>incompatibleMacroEngine.Plugin</classname>
+</plugin> \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine-c.check b/test/files/neg/macro-incompatible-macro-engine-c.check
new file mode 100644
index 0000000000..fb6c59ab7c
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-c.check
@@ -0,0 +1,4 @@
+macro-incompatible-macro-engine-c.scala:2: error: can't expand macros compiled by previous versions of Scala
+ MacroLibCompiledByScala210x.foo
+ ^
+one error found
diff --git a/test/files/neg/macro-incompatible-macro-engine-c.scala b/test/files/neg/macro-incompatible-macro-engine-c.scala
new file mode 100644
index 0000000000..037ac5f456
--- /dev/null
+++ b/test/files/neg/macro-incompatible-macro-engine-c.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ MacroLibCompiledByScala210x.foo
+} \ No newline at end of file
diff --git a/test/files/neg/macro-incompatible-macro-engine.check b/test/files/neg/macro-incompatible-macro-engine.check
deleted file mode 100644
index 1d582e5ed6..0000000000
--- a/test/files/neg/macro-incompatible-macro-engine.check
+++ /dev/null
@@ -1,7 +0,0 @@
-Test_3.scala:2: error: macro cannot be expanded, because it was compiled by an incompatible macro engine vxxx (implemented in the incompatibleMacroEngine plugin)
- Macros.foo
- ^
-Test_3.scala:3: error: macro cannot be expanded, because it was compiled by an incompatible macro engine vxxx (implemented in the incompatibleMacroEngine plugin)
- Macros.foo
- ^
-two errors found
diff --git a/test/files/neg/quasiquotes-syntax-error-position.check b/test/files/neg/quasiquotes-syntax-error-position.check
index fd55bd25b5..9fd6ce0417 100644
--- a/test/files/neg/quasiquotes-syntax-error-position.check
+++ b/test/files/neg/quasiquotes-syntax-error-position.check
@@ -32,4 +32,16 @@ quasiquotes-syntax-error-position.scala:14: error: ')' expected but end of quote
quasiquotes-syntax-error-position.scala:15: error: ':' expected but ')' found.
q"def foo(x)"
^
-11 errors found
+quasiquotes-syntax-error-position.scala:16: error: illegal start of simple expression
+ q"$a(])"
+ ^
+quasiquotes-syntax-error-position.scala:17: error: in XML literal: '>' expected instead of '$'
+ q"foo bar <xml$a>"
+ ^
+quasiquotes-syntax-error-position.scala:19: error: ';' expected but '<:' found.
+ q"val $x: $x <: $x"
+ ^
+quasiquotes-syntax-error-position.scala:20: error: '=' expected but '.' found.
+ q"def f ( $x ) . $x"
+ ^
+15 errors found
diff --git a/test/files/neg/quasiquotes-syntax-error-position.scala b/test/files/neg/quasiquotes-syntax-error-position.scala
index 7b1d66ba00..823fe9a551 100644
--- a/test/files/neg/quasiquotes-syntax-error-position.scala
+++ b/test/files/neg/quasiquotes-syntax-error-position.scala
@@ -13,4 +13,9 @@ object test extends App {
cq"pattern => body ; case pattern2 =>"
pq"$a(bar"
q"def foo(x)"
+ q"$a(])"
+ q"foo bar <xml$a>"
+ val x = q"x"
+ q"val $x: $x <: $x"
+ q"def f ( $x ) . $x"
}
diff --git a/test/files/neg/t4728.check b/test/files/neg/t4728.check
new file mode 100644
index 0000000000..c6ef182d34
--- /dev/null
+++ b/test/files/neg/t4728.check
@@ -0,0 +1,7 @@
+t4728.scala:10: error: ambiguous reference to overloaded definition,
+both method f in object Ambiguous of type (ys: Y*)Int
+and method f in object Ambiguous of type (x: X)Int
+match argument types (Y) and expected result type Any
+ println(Ambiguous.f(new Y))
+ ^
+one error found
diff --git a/test/pending/run/t4728.scala b/test/files/neg/t4728.scala
index 36f7860613..36f7860613 100644
--- a/test/pending/run/t4728.scala
+++ b/test/files/neg/t4728.scala
diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check
index f426bd2010..8a667f4b88 100644
--- a/test/files/neg/t5148.check
+++ b/test/files/neg/t5148.check
@@ -1,5 +1,5 @@
-error: bad symbolic reference. A signature in Imports.class refers to type Request
-in class scala.tools.nsc.interpreter.IMain which is not available.
-It may be completely missing from the current classpath, or the version on
-the classpath might be incompatible with the version used when compiling Imports.class.
+error: bad symbolic reference to scala.tools.nsc.interpreter.IMain.Request encountered in class file 'Imports.class'.
+Cannot access type Request in class scala.tools.nsc.interpreter.IMain. The current classpath may be
+missing a definition for scala.tools.nsc.interpreter.IMain.Request, or Imports.class may have been compiled against a version that's
+incompatible with the one found on the current classpath.
one error found
diff --git a/test/files/neg/t6988.check b/test/files/neg/t6988.check
new file mode 100644
index 0000000000..acb7b3cb08
--- /dev/null
+++ b/test/files/neg/t6988.check
@@ -0,0 +1,7 @@
+t6988.scala:3: error: annotation argument needs to be a constant; found: 13.asInstanceOf[Long]
+@SerialVersionUID(13.asInstanceOf[Long]) case class IdentifyMessage1(userName: String, user: User, code: Int)
+ ^
+t6988.scala:8: error: annotation argument needs to be a constant; found: O.SerialUID
+@SerialVersionUID(O.SerialUID) case class IdentifyMessage3(userName: String, user: User, code: Int)
+ ^
+two errors found
diff --git a/test/files/neg/t6988.scala b/test/files/neg/t6988.scala
new file mode 100644
index 0000000000..8171dc9dd0
--- /dev/null
+++ b/test/files/neg/t6988.scala
@@ -0,0 +1,10 @@
+case class User()
+
+@SerialVersionUID(13.asInstanceOf[Long]) case class IdentifyMessage1(userName: String, user: User, code: Int)
+@SerialVersionUID(13l) case class IdentifyMessage2(userName: String, user: User, code: Int)
+object O {
+ val SerialUID = "13".toLong
+}
+@SerialVersionUID(O.SerialUID) case class IdentifyMessage3(userName: String, user: User, code: Int)
+
+
diff --git a/test/files/neg/t8265.check b/test/files/neg/t8265.check
new file mode 100644
index 0000000000..7b1db1c4e5
--- /dev/null
+++ b/test/files/neg/t8265.check
@@ -0,0 +1,6 @@
+t8265.scala:1: warning: Construct depends on unsound variance analysis and will not compile in scala 2.11 and beyond
+class Foo[+CC[X]] { type Coll = CC[_] }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t8265.flags b/test/files/neg/t8265.flags
new file mode 100644
index 0000000000..9d7ba7abd8
--- /dev/null
+++ b/test/files/neg/t8265.flags
@@ -0,0 +1 @@
+-Xsource:2.10 -deprecation -language:higherKinds -Xfatal-warnings
diff --git a/test/files/neg/t8265.scala b/test/files/neg/t8265.scala
new file mode 100644
index 0000000000..a215903ebc
--- /dev/null
+++ b/test/files/neg/t8265.scala
@@ -0,0 +1 @@
+class Foo[+CC[X]] { type Coll = CC[_] }
diff --git a/test/files/neg/t8325-b.check b/test/files/neg/t8325-b.check
new file mode 100644
index 0000000000..ec80826dc0
--- /dev/null
+++ b/test/files/neg/t8325-b.check
@@ -0,0 +1,10 @@
+t8325-b.scala:3: error: Unmatched closing brace '}' ignored here
+ def k(is: Int*} = ???
+ ^
+t8325-b.scala:3: error: ';' expected but '=' found.
+ def k(is: Int*} = ???
+ ^
+t8325-b.scala:4: error: eof expected but '}' found.
+}
+^
+three errors found
diff --git a/test/files/neg/t8325-b.scala b/test/files/neg/t8325-b.scala
new file mode 100644
index 0000000000..6ac78708bb
--- /dev/null
+++ b/test/files/neg/t8325-b.scala
@@ -0,0 +1,4 @@
+
+trait Test {
+ def k(is: Int*} = ???
+}
diff --git a/test/files/neg/t8325-c.check b/test/files/neg/t8325-c.check
new file mode 100644
index 0000000000..51ea4988a6
--- /dev/null
+++ b/test/files/neg/t8325-c.check
@@ -0,0 +1,7 @@
+t8325-c.scala:3: error: identifier expected but ')' found.
+ def k(xx: Int`*`) = ???
+ ^
+t8325-c.scala:4: error: ')' expected but '}' found.
+}
+^
+two errors found
diff --git a/test/files/neg/t8325-c.scala b/test/files/neg/t8325-c.scala
new file mode 100644
index 0000000000..076202df3f
--- /dev/null
+++ b/test/files/neg/t8325-c.scala
@@ -0,0 +1,4 @@
+
+trait Test {
+ def k(xx: Int`*`) = ???
+}
diff --git a/test/files/neg/t8325.check b/test/files/neg/t8325.check
new file mode 100644
index 0000000000..175a0db415
--- /dev/null
+++ b/test/files/neg/t8325.check
@@ -0,0 +1,15 @@
+t8325.scala:5: error: *-parameter must come last
+ def f(is: Int*, s: String) = ???
+ ^
+t8325.scala:7: error: *-parameter must come last
+ def h(is: Int * String *, s: String) = ???
+ ^
+t8325.scala:10: error: type mismatch;
+ found : Int(5)
+ required: Int*
+ def j(is: Int* = 5) = ???
+ ^
+t8325.scala:10: error: a parameter section with a `*'-parameter is not allowed to have default arguments
+ def j(is: Int* = 5) = ???
+ ^
+four errors found
diff --git a/test/files/neg/t8325.scala b/test/files/neg/t8325.scala
new file mode 100644
index 0000000000..3813797e83
--- /dev/null
+++ b/test/files/neg/t8325.scala
@@ -0,0 +1,11 @@
+
+trait Test {
+ type OK[A,B] = A Tuple2 B
+ type *[A,B] = A Tuple2 B
+ def f(is: Int*, s: String) = ???
+ def g(is: Int * String, s: String) = ??? // OK
+ def h(is: Int * String *, s: String) = ???
+ // won't recover from following
+ //def i(is: Int OK) = ??? //error: identifier expected but ')' found.
+ def j(is: Int* = 5) = ???
+}
diff --git a/test/files/neg/t8372.check b/test/files/neg/t8372.check
new file mode 100644
index 0000000000..6a6424a834
--- /dev/null
+++ b/test/files/neg/t8372.check
@@ -0,0 +1,7 @@
+t8372.scala:7: error: No ClassTag available for T1
+ def unzip[T1, T2](a: Array[(T1, T2)]) = a.unzip
+ ^
+t8372.scala:9: error: No ClassTag available for T1
+ def unzip3[T1, T2, T3](a: Array[(T1, T2, T3)]): (Array[T1], Array[T2], Array[T3]) = a.unzip3
+ ^
+two errors found
diff --git a/test/files/neg/t8372.scala b/test/files/neg/t8372.scala
new file mode 100644
index 0000000000..60a674f4d8
--- /dev/null
+++ b/test/files/neg/t8372.scala
@@ -0,0 +1,10 @@
+class t8372 {
+ // failed with "error: tpe T1 is an unresolved spliceable type"; that was caused by
+ // misguided type inference of type parameters in ArrayOps.unzip
+ // the type inference failed because the order of implicit arguments was wrong
+ // the evidence that T <: (T1, T2) came as last argument so it couldn't guide the
+ // type inference early enough
+ def unzip[T1, T2](a: Array[(T1, T2)]) = a.unzip
+ // the same as above
+ def unzip3[T1, T2, T3](a: Array[(T1, T2, T3)]): (Array[T1], Array[T2], Array[T3]) = a.unzip3
+}
diff --git a/test/files/neg/t8376.check b/test/files/neg/t8376.check
new file mode 100644
index 0000000000..22ed942d51
--- /dev/null
+++ b/test/files/neg/t8376.check
@@ -0,0 +1,7 @@
+S.scala:2: error: overloaded method value m with alternatives:
+ (a: J*)Unit <and>
+ (a: String*)Unit
+ cannot be applied to (Int)
+ J.m(0)
+ ^
+one error found
diff --git a/test/files/neg/t8376/J.java b/test/files/neg/t8376/J.java
new file mode 100644
index 0000000000..29aa23da84
--- /dev/null
+++ b/test/files/neg/t8376/J.java
@@ -0,0 +1,4 @@
+class J {
+ public static void m(String... a) { }
+ public static void m(J... a) { }
+}
diff --git a/test/files/neg/t8376/S.scala b/test/files/neg/t8376/S.scala
new file mode 100644
index 0000000000..a19f0d3c06
--- /dev/null
+++ b/test/files/neg/t8376/S.scala
@@ -0,0 +1,4 @@
+object S {
+ J.m(0)
+ // the error message should show `T*` in the method signatures rather than `<repeated>[T]`
+}
diff --git a/test/files/neg/t8430.check b/test/files/neg/t8430.check
new file mode 100644
index 0000000000..7c6a73ce53
--- /dev/null
+++ b/test/files/neg/t8430.check
@@ -0,0 +1,27 @@
+t8430.scala:15: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:16: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:17: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:18: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:19: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:20: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+6 warnings found
+one error found
diff --git a/test/files/neg/t8430.flags b/test/files/neg/t8430.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t8430.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t8430.scala b/test/files/neg/t8430.scala
new file mode 100644
index 0000000000..4166b08a0a
--- /dev/null
+++ b/test/files/neg/t8430.scala
@@ -0,0 +1,32 @@
+sealed trait CL3Literal
+case object IntLit extends CL3Literal
+case object CharLit extends CL3Literal
+case object BooleanLit extends CL3Literal
+case object UnitLit extends CL3Literal
+
+
+sealed trait Tree
+case class LetL(value: CL3Literal) extends Tree
+case object LetP extends Tree
+case object LetC extends Tree
+case object LetF extends Tree
+
+object Test {
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ // After the first patch for SI-8430, we achieve stability: all of
+ // these get the same warning:
+ //
+ // ??, LetC, LetF, LetL(IntLit), LetP
+ //
+ // Before, it was non-deterministic.
+ //
+ // However, we our list of counter examples is itself non-exhaustive.
+ // We need to rework counter example generation to fix that.
+ //
+ // That work is the subject of SI-7746
+}
diff --git a/test/files/neg/t8431.check b/test/files/neg/t8431.check
new file mode 100644
index 0000000000..75351a8ae7
--- /dev/null
+++ b/test/files/neg/t8431.check
@@ -0,0 +1,27 @@
+t8431.scala:24: error: type mismatch;
+ found : CanBuildFrom[Invariant[Nothing]]
+ required: CanBuildFrom[Invariant[G]]
+ s.combined // fail
+ ^
+t8431.scala:24: error: value combined is not a member of Invariant[Nothing]
+ s.combined // fail
+ ^
+t8431.scala:35: error: type mismatch;
+ found : CanBuildFrom[Invariant[Nothing]]
+ required: CanBuildFrom[Invariant[G]]
+ s.combined // was okay!
+ ^
+t8431.scala:35: error: value combined is not a member of Invariant[Nothing]
+ s.combined // was okay!
+ ^
+t8431.scala:45: error: type mismatch;
+ found : CanBuildFrom[Invariant[Nothing]]
+ required: CanBuildFrom[Invariant[G]]
+ convert2(s).combined
+ ^
+t8431.scala:48: error: type mismatch;
+ found : CanBuildFrom[Invariant[Nothing]]
+ required: CanBuildFrom[Invariant[G]]
+ {val c1 = convert2(s); c1.combined}
+ ^
+6 errors found
diff --git a/test/files/neg/t8431.scala b/test/files/neg/t8431.scala
new file mode 100644
index 0000000000..032a1f394d
--- /dev/null
+++ b/test/files/neg/t8431.scala
@@ -0,0 +1,63 @@
+trait Covariant[+A]
+trait Invariant[A] extends Covariant[A @annotation.unchecked.uncheckedVariance]
+
+trait Combinable[G] {
+ def combined = 0
+}
+
+trait CanBuildFrom[+C]
+
+object C {
+ implicit def convert1[G, TRAVONCE[+e] <: Covariant[e]]
+ (xs: TRAVONCE[G]): Combinable[G] = ???
+
+ implicit def convert2[G, SET[e] <: Invariant[e]]
+ (xs: SET[_ <: G])
+ (implicit cbf: CanBuildFrom[SET[G]]): Combinable[G] = ???
+
+ implicit def cbf[A]: CanBuildFrom[Invariant[A]] = ???
+}
+// always failed
+class Test1 {
+ import C.{cbf, convert1, convert2}
+ val s: Invariant[Nothing] = ???
+ s.combined // fail
+}
+// didn't fail, now correctly fails
+class Test2 {
+ import C.{cbf, convert2, convert1}
+
+ val s: Invariant[Nothing] = ???
+
+ // Non-uniformity with Test1 was due to order of typechecking implicit candidates:
+ // the last candidate typechecked was the only one that could contribute undetermined type parameters
+ // to the enclosing context, due to mutation of `Context#undetparam` in `doTypedApply`.
+ s.combined // was okay!
+}
+
+
+class TestExplicit {
+ import C.{cbf, convert2}
+
+ val s: Invariant[Nothing] = ???
+
+ // Now the implicit Test fail uniformly as per this explicit conversion
+ convert2(s).combined
+
+ // Breaking this expression down doesn't make it work.
+ {val c1 = convert2(s); c1.combined}
+}
+
+// These ones work before and after; infering G=Null doesn't need to contribute an undetermined type param.
+class Test3 {
+ import C.{cbf, convert1, convert2}
+ val s: Invariant[Null] = ???
+ s.combined // okay
+}
+
+class Test4 {
+ import C.{cbf, convert2, convert1}
+
+ val s: Invariant[Null] = ???
+ s.combined // okay
+}
diff --git a/test/files/neg/t8450.check b/test/files/neg/t8450.check
new file mode 100644
index 0000000000..eeabb9730c
--- /dev/null
+++ b/test/files/neg/t8450.check
@@ -0,0 +1,6 @@
+t8450.scala:5: warning: implicit numeric widening
+ def elapsed: Foo = (System.nanoTime - 100L).foo
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t8450.flags b/test/files/neg/t8450.flags
new file mode 100644
index 0000000000..9a1332d7af
--- /dev/null
+++ b/test/files/neg/t8450.flags
@@ -0,0 +1 @@
+-Ywarn-numeric-widen -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t8450.scala b/test/files/neg/t8450.scala
new file mode 100644
index 0000000000..f20ed2bc31
--- /dev/null
+++ b/test/files/neg/t8450.scala
@@ -0,0 +1,12 @@
+trait Foo
+
+class WarnWidening {
+ implicit class FooDouble(d: Double) { def foo = new Foo {} }
+ def elapsed: Foo = (System.nanoTime - 100L).foo
+}
+
+class NoWarnWidening {
+ implicit class FooLong(l: Long) { def foo = new Foo {} }
+ implicit class FooDouble(d: Double) { def foo = new Foo {} }
+ def elapsed: Foo = (System.nanoTime - 100L).foo
+}
diff --git a/test/files/neg/t8463.check b/test/files/neg/t8463.check
new file mode 100644
index 0000000000..1a3eea2870
--- /dev/null
+++ b/test/files/neg/t8463.check
@@ -0,0 +1,10 @@
+t8463.scala:5: error: type mismatch;
+ found : Long
+ required: ?T[Long]
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method longWrapper in class LowPriorityImplicits of type (x: Long)scala.runtime.RichLong
+ and method ArrowAssoc in object Predef of type [A](self: A)ArrowAssoc[A]
+ are possible conversion functions from Long to ?T[Long]
+ insertCell(Foo(5))
+ ^
+one error found
diff --git a/test/files/neg/t8463.scala b/test/files/neg/t8463.scala
new file mode 100644
index 0000000000..7c954fd834
--- /dev/null
+++ b/test/files/neg/t8463.scala
@@ -0,0 +1,38 @@
+object Test {
+ case class Foo[+T[_]](activity:T[Long])
+ type Cell[T] = T
+ def insertCell(u:Foo[Cell]) = ???
+ insertCell(Foo(5))
+}
+
+/* If SI-8230 is fixed, and `viewExists` is changed to no longer leak
+ ambiguity errors, you might expect the check file for this test to
+ change as folloes:
+
+@@ -1,18 +1,10 @@
+-t8463.scala:5: error: no type parameters for method apply: (activity:
+- --- because ---
+-argument expression's type is not compatible with formal parameter ty
++t8463.scala:5: error: type mismatch;
+ found : Long
+ required: ?T[Long]
++Note that implicit conversions are not applicable because they are am
++ both method longWrapper in class LowPriorityImplicits of type (x: Lo
++ and method ArrowAssoc in object Predef of type [A](self: A)ArrowAsso
++ are possible conversion functions from Long to ?T[Long]
+ insertCell(Foo(5))
+- ^
+-t8463.scala:5: error: type mismatch;
+- found : Long(5L)
+- required: T[Long]
+- insertCell(Foo(5))
+- ^
+-t8463.scala:5: error: type mismatch;
+- found : Test.Foo[T]
+- required: Test.Foo[Test.Cell]
+- insertCell(Foo(5))
+- ^
+-three errors found
++ ^
++one error found
+*/
diff --git a/test/files/pos/t8157-2.10.flags b/test/files/pos/t8157-2.10.flags
new file mode 100644
index 0000000000..94c8056747
--- /dev/null
+++ b/test/files/pos/t8157-2.10.flags
@@ -0,0 +1 @@
+-Xsource:2.10
diff --git a/test/files/pos/t8157-2.10.scala b/test/files/pos/t8157-2.10.scala
new file mode 100644
index 0000000000..597585a96d
--- /dev/null
+++ b/test/files/pos/t8157-2.10.scala
@@ -0,0 +1,5 @@
+object Test { // PolyTYped function default arg unicity check,
+ // fails in 2.11, authorized under -Xsource:2.10
+ def foo(printer: Any, question: => String, show: Boolean = false)(op: => Any): Any = ???
+ def foo[T](question: => String, show: Boolean)(op: => Any = ()): Any = ???
+}
diff --git a/test/files/pos/t8325.scala b/test/files/pos/t8325.scala
new file mode 100644
index 0000000000..af33ee7bb3
--- /dev/null
+++ b/test/files/pos/t8325.scala
@@ -0,0 +1,9 @@
+
+trait Test {
+ type +[A, B] = (A, B)
+ type *[A, B] = (A, B)
+
+ type X[A, B] = A + B
+ type Y[A, B] = A * B
+ type Z[A, B] = A `*` B
+}
diff --git a/test/files/pos/t8329.scala b/test/files/pos/t8329.scala
new file mode 100644
index 0000000000..fcd5e50b37
--- /dev/null
+++ b/test/files/pos/t8329.scala
@@ -0,0 +1,29 @@
+object Test {
+ def pf(pf: PartialFunction[Any, Unit]) = ()
+ def f1(pf: Function[Any, Unit]) = ()
+
+ class A1; class B1
+ def test1(x: String, x1: String, default: String) = pf {
+ case _ if (
+ x.isEmpty
+ && default.isEmpty // was binding to synthetic param
+ && x1.isEmpty // was binding to synthetic param
+ ) =>
+ x.isEmpty
+ default.isEmpty // was binding to synthetic param
+ x1.isEmpty // was binding to synthetic param
+ new A1; new B1
+ }
+
+ def test2(x: String, x1: String, default: String) = f1 {
+ case _ if (
+ x.isEmpty
+ && default.isEmpty
+ && x1.isEmpty
+ ) =>
+ x.isEmpty
+ default.isEmpty
+ x1.isEmpty
+ new A1; new B1
+ }
+}
diff --git a/test/files/pos/t8352.check b/test/files/pos/t8352.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t8352.check
diff --git a/test/files/pos/t8352/Macros_1.scala b/test/files/pos/t8352/Macros_1.scala
new file mode 100644
index 0000000000..f5c8ce578f
--- /dev/null
+++ b/test/files/pos/t8352/Macros_1.scala
@@ -0,0 +1,7 @@
+import scala.reflect.macros.whitebox._
+import scala.language.experimental.macros
+
+object Macros {
+ def impl(c: Context)(x: c.Expr[Boolean]): c.Expr[Boolean] = x
+ def foo(x: Boolean): Boolean = macro impl
+} \ No newline at end of file
diff --git a/test/files/pos/t8352/Test_2.scala b/test/files/pos/t8352/Test_2.scala
new file mode 100644
index 0000000000..b5bfe92ffb
--- /dev/null
+++ b/test/files/pos/t8352/Test_2.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ def expectUnit() {
+ Macros.foo(true)
+ }
+} \ No newline at end of file
diff --git a/test/files/pos/t8363.flags b/test/files/pos/t8363.flags
new file mode 100644
index 0000000000..48b438ddf8
--- /dev/null
+++ b/test/files/pos/t8363.flags
@@ -0,0 +1 @@
+-Ydelambdafy:method
diff --git a/test/files/pos/t8363.scala b/test/files/pos/t8363.scala
new file mode 100644
index 0000000000..639faf4120
--- /dev/null
+++ b/test/files/pos/t8363.scala
@@ -0,0 +1,7 @@
+class C(a: Any)
+class Test {
+ def foo: Any = {
+ def form = 0
+ class C1 extends C(() => form)
+ }
+}
diff --git a/test/files/pos/t8364.check b/test/files/pos/t8364.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t8364.check
diff --git a/test/files/pos/t8364.scala b/test/files/pos/t8364.scala
new file mode 100644
index 0000000000..7a7ea1ff12
--- /dev/null
+++ b/test/files/pos/t8364.scala
@@ -0,0 +1,12 @@
+import scala.language.dynamics
+
+object MyDynamic extends Dynamic {
+ def selectDynamic(name: String): Any = ???
+}
+
+object Test extends App {
+ locally {
+ import java.lang.String
+ MyDynamic.id
+ }
+}
diff --git a/test/files/pos/t8367.scala b/test/files/pos/t8367.scala
new file mode 100644
index 0000000000..cae2415405
--- /dev/null
+++ b/test/files/pos/t8367.scala
@@ -0,0 +1,11 @@
+package java.lang
+
+// SI-8367 shows something is wrong with primaryConstructor and it was made worse with the fix for SI-8192
+// perhaps primaryConstructor should not return NoSymbol when isJavaDefined
+// or, perhaps isJavaDefined should be refined (the package definition above is pretty sneaky)
+// also, why does this only happen for a (scala-defined!) class with this special name?
+// (there are a couple of others: CloneNotSupportedException,InterruptedException)
+class Throwable
+
+// class CloneNotSupportedException
+// class InterruptedException \ No newline at end of file
diff --git a/test/files/pos/t8369a.check b/test/files/pos/t8369a.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t8369a.check
diff --git a/test/files/pos/t8369a.scala b/test/files/pos/t8369a.scala
new file mode 100644
index 0000000000..0596fdaf74
--- /dev/null
+++ b/test/files/pos/t8369a.scala
@@ -0,0 +1,5 @@
+object Bug {
+ trait Sys[S]
+ def test[S <: Sys[S]] = read[S]()
+ def read[S <: Sys[S]](baz: Any = 0): Some[S] = ???
+} \ No newline at end of file
diff --git a/test/files/pos/t8369b.check b/test/files/pos/t8369b.check
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/files/pos/t8369b.check
diff --git a/test/files/pos/t8369b.scala b/test/files/pos/t8369b.scala
new file mode 100644
index 0000000000..8145911db1
--- /dev/null
+++ b/test/files/pos/t8369b.scala
@@ -0,0 +1,18 @@
+object Bug {
+ trait Sys[S] {
+ type Tx
+ }
+
+ trait Baz[-Tx]
+
+ trait Foo[S <: Sys[S]] {
+ def bar: Bar[S] = Bar.read[S]()
+ }
+
+ object Bar {
+ object NoBaz extends Baz[Any]
+
+ def read[S <: Sys[S]](baz: Baz[S#Tx] = NoBaz): Bar[S] = ???
+ }
+ trait Bar[S <: Sys[S]]
+} \ No newline at end of file
diff --git a/test/files/pos/t8376/BindingsX.java b/test/files/pos/t8376/BindingsX.java
new file mode 100644
index 0000000000..165fdaf5f6
--- /dev/null
+++ b/test/files/pos/t8376/BindingsX.java
@@ -0,0 +1,13 @@
+/**
+ * A simple Java class implementing methods similar to new JavaFX `Bindings`.
+ */
+public final class BindingsX {
+
+ public static void select(String root, String... steps) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public static void select(Object root, String... steps) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+}
diff --git a/test/files/pos/t8376/Test.scala b/test/files/pos/t8376/Test.scala
new file mode 100644
index 0000000000..ba078a3532
--- /dev/null
+++ b/test/files/pos/t8376/Test.scala
@@ -0,0 +1,10 @@
+class Test {
+ BindingsX.select("", "") // okay in 2.10, fails in 2.11
+
+ BindingsY.select1("", "") // okay in both
+}
+
+object BindingsY {
+ def select1(root: String, steps: String*) = ()
+ def select1(root: Any, steps: String*) = ()
+}
diff --git a/test/files/pos/t8403.scala b/test/files/pos/t8403.scala
new file mode 100644
index 0000000000..eea60ed7ff
--- /dev/null
+++ b/test/files/pos/t8403.scala
@@ -0,0 +1,9 @@
+trait Bug {
+ val u: { type Amb } = ???
+ import u._
+
+ class Amb { def x = 0 }
+ class C(x: Amb) { // after dbd8457e4, "reference to Amb is ambiguous"
+ x.x
+ }
+}
diff --git a/test/files/pos/t8411/Macros_1.scala b/test/files/pos/t8411/Macros_1.scala
new file mode 100644
index 0000000000..c5319c559c
--- /dev/null
+++ b/test/files/pos/t8411/Macros_1.scala
@@ -0,0 +1,10 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def defaultZeroCase(pf: PartialFunction[Int, Int]): PartialFunction[Int, Int] = macro impl
+ def impl(c: Context)(pf: c.Tree) = { import c.universe._
+ val q"{ case ..$cases }" = pf
+ q"{ case ..$cases case _ => 0 }"
+ }
+}
diff --git a/test/files/pos/t8411/Test_2.scala b/test/files/pos/t8411/Test_2.scala
new file mode 100644
index 0000000000..a0ad30f0f5
--- /dev/null
+++ b/test/files/pos/t8411/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ val pf = Macros.defaultZeroCase { case 1 => 2 }
+ assert(pf(2) == 0)
+}
diff --git a/test/files/pos/t8460.scala b/test/files/pos/t8460.scala
new file mode 100644
index 0000000000..10d2ed432c
--- /dev/null
+++ b/test/files/pos/t8460.scala
@@ -0,0 +1,25 @@
+object tan extends UFunc {
+ implicit def ImplDouble: Impl[Double, Double] = ???
+}
+
+trait UFunc {
+ trait TC[+A]
+ type Impl[V, VR] = UFunc.UImpl[this.type, V, VR]
+}
+
+object UFunc {
+ class UImpl[A, B, C]
+ implicit def implicitDoubleUTag[Tag, V, VR](implicit conv: V=>Double, impl: UImpl[Tag, Double, VR]):UImpl[Tag, V, VR] = ???
+
+}
+
+object Test {
+ implicitly[tan.Impl[Double, Double]]
+ // we should discard the one and only divergent implicit (`implicitDoubleUTag`)
+ // This is done under `scalac-hash v2.10.4 test.scala`, but not under
+ // `scalac-hash v2.10.4 -Xdivergence211 test.scala`
+ //
+ // This seems to be because the companion implicits contain redundant entries
+ //
+
+}
diff --git a/test/files/pos/t8497/A_1.scala b/test/files/pos/t8497/A_1.scala
new file mode 100644
index 0000000000..6a76b0ee99
--- /dev/null
+++ b/test/files/pos/t8497/A_1.scala
@@ -0,0 +1,13 @@
+package p {
+ object Crash {
+ def e(s: (String @java.lang.Deprecated)): Unit = ()
+ def f(s: (String @nonStatic)): Unit = ()
+ }
+ object Ok {
+ def g(s: (String @nonStatic @static)): Unit = ()
+ def h(s: (String @static)): Unit = ()
+ }
+}
+
+class nonStatic extends scala.annotation.Annotation
+class static extends scala.annotation.StaticAnnotation
diff --git a/test/files/pos/t8497/B_2.scala b/test/files/pos/t8497/B_2.scala
new file mode 100644
index 0000000000..efe2edf2c3
--- /dev/null
+++ b/test/files/pos/t8497/B_2.scala
@@ -0,0 +1 @@
+package p { object Test { Crash } }
diff --git a/test/files/pos/t8523.flags b/test/files/pos/t8523.flags
new file mode 100644
index 0000000000..c7d406c649
--- /dev/null
+++ b/test/files/pos/t8523.flags
@@ -0,0 +1 @@
+-Ywarn-dead-code -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/t8523.scala b/test/files/pos/t8523.scala
new file mode 100644
index 0000000000..dfcb35404d
--- /dev/null
+++ b/test/files/pos/t8523.scala
@@ -0,0 +1,10 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+class Impl(val c: Context) {
+ def impl: c.Tree = ???
+}
+
+object Macros {
+ def foo: Any = macro Impl.impl
+} \ No newline at end of file
diff --git a/test/files/run/mirror_symbolof_x.check b/test/files/run/mirror_symbolof_x.check
new file mode 100644
index 0000000000..cc9cad7a13
--- /dev/null
+++ b/test/files/run/mirror_symbolof_x.check
@@ -0,0 +1,13 @@
+class Int
+object C
+type T
+type Id
+class Nothing
+class Null
+class Int
+object C
+type T
+type Id
+class Nothing
+class Null
+exception: class C not found.
diff --git a/test/files/run/mirror_symbolof_x.scala b/test/files/run/mirror_symbolof_x.scala
new file mode 100644
index 0000000000..8fec301f56
--- /dev/null
+++ b/test/files/run/mirror_symbolof_x.scala
@@ -0,0 +1,43 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.reflect.api.Mirror
+
+class C
+object C
+
+object Test extends App {
+ object test1 {
+ val m = cm
+ type T = Int
+ type Id[X] = X
+ println(m.symbolOf[Int]: ru.TypeSymbol)
+ println(m.symbolOf[C.type]: ru.TypeSymbol)
+ println(m.symbolOf[T]: ru.TypeSymbol)
+ println(m.symbolOf[Id[_]]: ru.TypeSymbol)
+ println(m.symbolOf[Nothing]: ru.TypeSymbol)
+ println(m.symbolOf[Null]: ru.TypeSymbol)
+ }
+
+ object test2 {
+ val m: Mirror[ru.type] = cm
+ type T = Int
+ type Id[X] = X
+ println(m.symbolOf[Int]: ru.TypeSymbol)
+ println(m.symbolOf[C.type]: ru.TypeSymbol)
+ println(m.symbolOf[T]: ru.TypeSymbol)
+ println(m.symbolOf[Id[_]]: ru.TypeSymbol)
+ println(m.symbolOf[Nothing]: ru.TypeSymbol)
+ println(m.symbolOf[Null]: ru.TypeSymbol)
+ }
+
+ object test3 {
+ val m = ru.runtimeMirror(classOf[Int].getClass.getClassLoader)
+ try println(m.symbolOf[C])
+ catch { case ex: ScalaReflectionException => println(s"exception: ${ex.getMessage}") }
+ }
+
+ test1
+ test2
+ test3
+}
diff --git a/test/files/run/t6196.scala b/test/files/run/t6196.scala
index 16c2c7409d..a75911fb9e 100644
--- a/test/files/run/t6196.scala
+++ b/test/files/run/t6196.scala
@@ -43,7 +43,7 @@ object Test extends App {
override def equals(that:Any) = {
equalsCount += 1
- this match {
+ that match {
case HashCounter(value) => this.value == value
case _ => false
}
diff --git a/test/files/run/t6200.scala b/test/files/run/t6200.scala
index 9a5d91e042..75600cd557 100644
--- a/test/files/run/t6200.scala
+++ b/test/files/run/t6200.scala
@@ -43,7 +43,7 @@ object Test extends App {
override def equals(that: Any) = {
equalsCount += 1
- this match {
+ that match {
case HashCounter(value) => this.value == value
case _ => false
}
diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check
index 83d8fe20c1..9bb9b5694f 100644
--- a/test/files/run/t6392b.check
+++ b/test/files/run/t6392b.check
@@ -1 +1 @@
-ModuleDef(Modifiers(), TermName("C")#MOD, Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), noSelfType, List(DefDef(Modifiers(), termNames.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), typeNames.EMPTY), termNames.CONSTRUCTOR#CTOR), List())), Literal(Constant(())))))))
+ModuleDef(Modifiers(), TermName("C")#MOD, Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), noSelfType, List(DefDef(Modifiers(), termNames.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), typeNames.EMPTY), termNames.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
diff --git a/test/files/run/t6440.check b/test/files/run/t6440.check
index 806279fb74..27d5d1380e 100644
--- a/test/files/run/t6440.check
+++ b/test/files/run/t6440.check
@@ -1,4 +1,4 @@
-pos: source-newSource1.scala,line-9,offset=109 bad symbolic reference. A signature in U.class refers to term pack1
-in package <root> which is not available.
-It may be completely missing from the current classpath, or the version on
-the classpath might be incompatible with the version used when compiling U.class. ERROR
+pos: source-newSource1.scala,line-9,offset=109 bad symbolic reference to <root>.pack1 encountered in class file 'U.class'.
+Cannot access term pack1 in package <root>. The current classpath may be
+missing a definition for <root>.pack1, or U.class may have been compiled against a version that's
+incompatible with the one found on the current classpath. ERROR
diff --git a/test/files/run/t6440b.check b/test/files/run/t6440b.check
index 9771ce5efb..0b642c2c35 100644
--- a/test/files/run/t6440b.check
+++ b/test/files/run/t6440b.check
@@ -1,4 +1,4 @@
-pos: NoPosition bad symbolic reference. A signature in U.class refers to type T
-in package pack1 which is not available.
-It may be completely missing from the current classpath, or the version on
-the classpath might be incompatible with the version used when compiling U.class. ERROR
+pos: NoPosition bad symbolic reference to pack1.T encountered in class file 'U.class'.
+Cannot access type T in package pack1. The current classpath may be
+missing a definition for pack1.T, or U.class may have been compiled against a version that's
+incompatible with the one found on the current classpath. ERROR
diff --git a/test/files/run/t6988.check b/test/files/run/t6988.check
new file mode 100644
index 0000000000..5db04832d6
--- /dev/null
+++ b/test/files/run/t6988.check
@@ -0,0 +1,2 @@
+#1 13
+#2 13
diff --git a/test/files/run/t6988.scala b/test/files/run/t6988.scala
new file mode 100644
index 0000000000..45dfe33461
--- /dev/null
+++ b/test/files/run/t6988.scala
@@ -0,0 +1,9 @@
+case class User()
+
+@SerialVersionUID(13l) case class IdentifyMessage1(userName: String, user: User, code: Int)
+@SerialVersionUID(10l + 3l) case class IdentifyMessage2(userName: String, user: User, code: Int)
+
+object Test extends App {
+ println("#1 " + java.io.ObjectStreamClass.lookup(IdentifyMessage1("hei", User(), 8).getClass).getSerialVersionUID)
+ println("#2 " + java.io.ObjectStreamClass.lookup(IdentifyMessage2("hei", User(), 8).getClass).getSerialVersionUID)
+}
diff --git a/test/files/run/t7582-private-within.check b/test/files/run/t7582-private-within.check
index 1b9a0910af..b2743ffa06 100644
--- a/test/files/run/t7582-private-within.check
+++ b/test/files/run/t7582-private-within.check
@@ -2,7 +2,7 @@ private[package pack] class JavaPackagePrivate
private[package pack] module JavaPackagePrivate
private[package pack] module class JavaPackagePrivate
private[package pack] field field
-private[package pack] constructor <init>
+private[package pack] primary constructor <init>
private[package pack] method meth
private[package pack] field staticField
private[package pack] method staticMeth
diff --git a/test/files/run/t7992.scala b/test/files/run/t7992.scala
new file mode 100644
index 0000000000..fde231b961
--- /dev/null
+++ b/test/files/run/t7992.scala
@@ -0,0 +1,20 @@
+class C {
+ def foo: Int = 0
+}
+
+class D extends C {
+ override def foo: Int = {
+ val f = () => {
+ class C // comment this line to fix.
+ D.super.foo // no super accessor generated here!
+ // java.lang.VerifyError: (class: D$$anonfun$1, method: apply$mcI$sp signature: ()I) Illegal use of nonvirtual function call
+ }
+ f()
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ new D().foo
+ }
+}
diff --git a/test/files/run/t7992b.scala b/test/files/run/t7992b.scala
new file mode 100644
index 0000000000..6fe1f990d5
--- /dev/null
+++ b/test/files/run/t7992b.scala
@@ -0,0 +1,18 @@
+class C {
+ def foo: Int = 0
+}
+
+class E extends C {
+ override def foo: Int = {
+ (None: Option[Int]).getOrElse {
+ class C
+ E.super.foo
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ new E().foo
+ }
+}
diff --git a/test/files/run/t8192.check b/test/files/run/t8192.check
index 7195703e19..2423a7acbf 100644
--- a/test/files/run/t8192.check
+++ b/test/files/run/t8192.check
@@ -1,10 +1,4 @@
compile-time
-class File
-primary constructor: NoSymbol
-def <init>(x$1: String): java.io.File => false
-def <init>(x$1: String,x$2: String): java.io.File => false
-def <init>(x$1: java.io.File,x$2: String): java.io.File => false
-def <init>(x$1: java.net.URI): java.io.File => false
package scala
primary constructor: NoSymbol
object List
@@ -21,12 +15,6 @@ primary constructor: def <init>(x: Int): C => true
def <init>(x: Int): C => true
def <init>(x: String): C => false
runtime
-class File
-primary constructor: NoSymbol
-def <init>(x$1: java.io.File,x$2: java.lang.String): java.io.File => false
-def <init>(x$1: java.lang.String): java.io.File => false
-def <init>(x$1: java.lang.String,x$2: java.lang.String): java.io.File => false
-def <init>(x$1: java.net.URI): java.io.File => false
package scala
primary constructor: NoSymbol
object List
diff --git a/test/files/run/t8192/Macros_1.scala b/test/files/run/t8192/Macros_1.scala
index ddad9fb872..72fb2cf313 100644
--- a/test/files/run/t8192/Macros_1.scala
+++ b/test/files/run/t8192/Macros_1.scala
@@ -30,7 +30,8 @@ object Macros {
}
println("compile-time")
- test(typeOf[File].typeSymbol.asClass)
+ // SI-8367 primaryConstructor for Java-defined classes is unstable, so I'm commenting this out
+ // test(typeOf[File].typeSymbol.asClass)
test(definitions.ScalaPackageClass)
test(definitions.ListModule.moduleClass.asClass)
test(typeOf[Product1[_]].typeSymbol.asClass)
diff --git a/test/files/run/t8192/Test_2.scala b/test/files/run/t8192/Test_2.scala
index 29f187c171..89302083ad 100644
--- a/test/files/run/t8192/Test_2.scala
+++ b/test/files/run/t8192/Test_2.scala
@@ -30,7 +30,8 @@ object Test extends App {
Macros.foo
println("runtime")
- test(typeOf[File].typeSymbol.asClass)
+ // SI-8367 primaryConstructor for Java-defined classes is unstable, so I'm commenting this out
+ // test(typeOf[File].typeSymbol.asClass)
test(definitions.ScalaPackageClass)
test(definitions.ListModule.moduleClass.asClass)
test(typeOf[Product1[_]].typeSymbol.asClass)
diff --git a/test/files/run/t8197.scala b/test/files/run/t8197.scala
index 5ca67088de..910a3ebc83 100644
--- a/test/files/run/t8197.scala
+++ b/test/files/run/t8197.scala
@@ -1,7 +1,7 @@
-// NOTE: according to SI-4728, this shouldn't even compile...
+// SI-8197, see also SI-4592 and SI-4728
class A
class B
-// default arguments do not participate in overload resolution
+
class Foo(val x: A = null) {
def this(bla: B*) {
this(new A)
@@ -9,5 +9,8 @@ class Foo(val x: A = null) {
}
object Test extends App {
+ // both constructors of `Foo` are applicable. Overloading resolution
+ // will eliminate the alternative that uses a default argument, therefore
+ // the vararg constructor is chosen.
assert((new Foo).x != null)
}
diff --git a/test/files/run/t8266-octal-interp.check b/test/files/run/t8266-octal-interp.check
index 6e9454119b..66ecafddc2 100644
--- a/test/files/run/t8266-octal-interp.check
+++ b/test/files/run/t8266-octal-interp.check
@@ -10,7 +10,7 @@ t8266-octal-interp.scala:6: warning: Octal escape literals are deprecated, use \
t8266-octal-interp.scala:7: warning: Octal escape literals are deprecated, use \r instead.
f"a\15c",
^
-t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use \u0022 instead.
+t8266-octal-interp.scala:8: warning: Octal escape literals are deprecated, use ${'"'} or a triple-quoted literal """with embedded " or \u0022""" instead.
f"a\42c",
^
t8266-octal-interp.scala:9: warning: Octal escape literals are deprecated, use \\ instead.
diff --git a/test/files/run/t8395.scala b/test/files/run/t8395.scala
new file mode 100644
index 0000000000..2570550619
--- /dev/null
+++ b/test/files/run/t8395.scala
@@ -0,0 +1,9 @@
+ object Test {
+ def baz(x: Object) = {
+ val s @ (_s: String) = x
+ x
+ }
+ def main(args: Array[String]) {
+ assert(baz("1") == "1")
+ }
+}
diff --git a/test/files/run/t8425.check b/test/files/run/t8425.check
new file mode 100644
index 0000000000..8379fa0a74
--- /dev/null
+++ b/test/files/run/t8425.check
@@ -0,0 +1 @@
+List(fresh$macro$1, $macro$2)
diff --git a/test/files/run/t8425/Macros_1.scala b/test/files/run/t8425/Macros_1.scala
new file mode 100644
index 0000000000..71a96518e8
--- /dev/null
+++ b/test/files/run/t8425/Macros_1.scala
@@ -0,0 +1,12 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.blackbox.Context
+
+object Macros {
+ def foo: Unit = macro impl
+ def impl(c: Context) = {
+ import c.universe._
+ val test1 = c.freshName()
+ val test2 = c.freshName("$")
+ q"println(List($test1, $test2))"
+ }
+} \ No newline at end of file
diff --git a/test/files/run/t8425/Test_2.scala b/test/files/run/t8425/Test_2.scala
new file mode 100644
index 0000000000..acfddae942
--- /dev/null
+++ b/test/files/run/t8425/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.foo
+} \ No newline at end of file
diff --git a/test/files/run/t8428.scala b/test/files/run/t8428.scala
new file mode 100644
index 0000000000..7da1207b7b
--- /dev/null
+++ b/test/files/run/t8428.scala
@@ -0,0 +1,12 @@
+object Test extends App {
+ val xs = List.tabulate(4)(List(_))
+ val i = xs.map(_.iterator).reduce { (a,b) =>
+ a.hasNext
+ a ++ b
+ }
+
+ val r1 = i.toList
+ val r2 = xs.flatten.toList
+
+ assert(r1 == r2, r1)
+}
diff --git a/test/files/run/t8437.check b/test/files/run/t8437.check
new file mode 100644
index 0000000000..fd3c81a4d7
--- /dev/null
+++ b/test/files/run/t8437.check
@@ -0,0 +1,2 @@
+5
+5
diff --git a/test/files/run/t8437/Macros_1.scala b/test/files/run/t8437/Macros_1.scala
new file mode 100644
index 0000000000..6286ea2a8c
--- /dev/null
+++ b/test/files/run/t8437/Macros_1.scala
@@ -0,0 +1,18 @@
+import scala.language.experimental.macros
+import scala.reflect.macros._
+
+abstract class AbstractBundle(val c: blackbox.Context) {
+ import c.Expr
+ import c.universe._
+ def foo: Expr[Int] = Expr[Int](q"5")
+}
+
+class ConcreteBundle(override val c: blackbox.Context) extends AbstractBundle(c) {
+ import c.Expr
+ val bar: Expr[Int] = foo
+}
+
+object InvokeBundle {
+ def foo: Int = macro ConcreteBundle.foo // nope
+ def bar: Int = macro ConcreteBundle.bar // yep
+} \ No newline at end of file
diff --git a/test/files/run/t8437/Test_2.scala b/test/files/run/t8437/Test_2.scala
new file mode 100644
index 0000000000..47bb84ad0e
--- /dev/null
+++ b/test/files/run/t8437/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(InvokeBundle.foo)
+ println(InvokeBundle.bar)
+} \ No newline at end of file
diff --git a/test/files/run/t8549.check b/test/files/run/t8549.check
new file mode 100644
index 0000000000..a92ddc0e51
--- /dev/null
+++ b/test/files/run/t8549.check
@@ -0,0 +1 @@
+warning: there were 2 deprecation warning(s); re-run with -deprecation for details
diff --git a/test/files/run/t8549.scala b/test/files/run/t8549.scala
new file mode 100644
index 0000000000..1b402d2d22
--- /dev/null
+++ b/test/files/run/t8549.scala
@@ -0,0 +1,175 @@
+import javax.xml.bind.DatatypeConverter._
+import scala.reflect.io.File
+
+// This test is self-modifying when run as follows:
+//
+// (export V=v2.10.4
+// scalac-hash $V test/files/run/t8549.scala
+// scala-hash $V -Doverwrite.source=test/files/run/t8549.scala Test
+// )
+//
+// Use this to re-establish a baseline for serialization compatibility.
+object Test extends App {
+ val overwrite: Option[File] = sys.props.get("overwrite.source").map(s => new File(new java.io.File(s)))
+
+ def serialize(o: AnyRef): String = {
+ val bos = new java.io.ByteArrayOutputStream()
+ val out = new java.io.ObjectOutputStream(bos)
+ out.writeObject(o)
+ out.flush()
+ printBase64Binary(bos.toByteArray())
+ }
+
+ def amend(file: File)(f: String => String) {
+ file.writeAll(f(file.slurp))
+ }
+ def quote(s: String) = List("\"", s, "\"").mkString
+
+ def patch(file: File, line: Int, prevResult: String, result: String) {
+ amend(file) {
+ content =>
+ content.lines.toList.zipWithIndex.map {
+ case (content, i) if i == line - 1 =>
+ val newContent = content.replaceAllLiterally(quote(prevResult), quote(result))
+ if (newContent != content)
+ println(s"- $content\n+ $newContent\n")
+ newContent
+ case (content, _) => content
+ }.mkString("\n")
+ }
+ }
+
+ def updateComment(file: File) {
+ val timestamp = {
+ import java.text.SimpleDateFormat
+ val sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss")
+ sdf.format(new java.util.Date)
+ }
+ val newComment = s" // Generated on $timestamp with Scala ${scala.util.Properties.versionString})"
+ amend(file) {
+ content =>
+ content.lines.toList.map {
+ f => f.replaceAll("""^ +// Generated on.*""", newComment)
+ }.mkString("\n")
+ }
+ }
+
+ def deserialize(string: String): AnyRef = {
+ val bis = new java.io.ByteArrayInputStream(parseBase64Binary(string))
+ val in = new java.io.ObjectInputStream(bis)
+ in.readObject()
+ }
+
+ def checkRoundTrip[T <: AnyRef](instance: T)(f: T => AnyRef) {
+ val result = serialize(instance)
+ val reconstituted = deserialize(result).asInstanceOf[T]
+ assert(f(instance) == f(reconstituted), (f(instance), f(reconstituted)))
+ }
+
+ def check[T <: AnyRef](instance: => T)(prevResult: String, f: T => AnyRef = (x: T) => x) {
+ val result = serialize(instance)
+ overwrite match {
+ case Some(f) =>
+ val lineNumberOfLiteralString = Thread.currentThread.getStackTrace.apply(2).getLineNumber
+ patch(f, lineNumberOfLiteralString, prevResult, result)
+ case None =>
+ checkRoundTrip(instance)(f)
+ assert(f(deserialize(prevResult).asInstanceOf[T]) == f(instance), s"$instance != f(deserialize(prevResult))")
+ assert(prevResult == result, s"instance = $instance : ${instance.getClass}\n serialization unstable: ${prevResult}\n found: ${result}")
+ }
+ }
+
+ // Generated on 20140505-14:47:14 with Scala version 2.11.1-20140505-142300-e8562571d2)
+ overwrite.foreach(updateComment)
+
+ check(List(1, 2, 3))( "rO0ABXNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHg=")
+ check(Nil)( "rO0ABXNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgAsc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdFNlcmlhbGl6ZUVuZCSKXGNb91MLbQIAAHhweA==")
+
+ check(Vector(1))( "rO0ABXNyACFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5WZWN0b3Lkd3dcHq6PXAIAC0kABWRlcHRoWgAFZGlydHlJAAhlbmRJbmRleEkABWZvY3VzSQAKc3RhcnRJbmRleFsACGRpc3BsYXkwdAATW0xqYXZhL2xhbmcvT2JqZWN0O1sACGRpc3BsYXkxcQB+AAFbAAhkaXNwbGF5MnEAfgABWwAIZGlzcGxheTNxAH4AAVsACGRpc3BsYXk0cQB+AAFbAAhkaXNwbGF5NXEAfgABeHAAAAABAAAAAAEAAAAAAAAAAHVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAACBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcA==")
+ check(Vector())( "rO0ABXNyACFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5WZWN0b3Lkd3dcHq6PXAIAC0kABWRlcHRoWgAFZGlydHlJAAhlbmRJbmRleEkABWZvY3VzSQAKc3RhcnRJbmRleFsACGRpc3BsYXkwdAATW0xqYXZhL2xhbmcvT2JqZWN0O1sACGRpc3BsYXkxcQB+AAFbAAhkaXNwbGF5MnEAfgABWwAIZGlzcGxheTNxAH4AAVsACGRpc3BsYXk0cQB+AAFbAAhkaXNwbGF5NXEAfgABeHAAAAAAAAAAAAAAAAAAAAAAAHBwcHBwcA==")
+
+ object Enum extends Enumeration {
+ val V1 = new Value { def id = 42 }
+ val V2 = new Val(42)
+ }
+
+ import collection.{ mutable, immutable }
+
+ class C
+ check(reflect.classTag[C])("rO0ABXNyAB5zY2FsYS5yZWZsZWN0LkNsYXNzVGFnJCRhbm9uJDG7ePPrmQBkhgIAAUwAD3J1bnRpbWVDbGFzczEkMXQAEUxqYXZhL2xhbmcvQ2xhc3M7eHB2cgAGVGVzdCRDAAAAAAAAAAAAAAB4cA==")
+ check(reflect.classTag[Int])("rO0ABX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pb24kJG5tYXB0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL01hcDtMABdzY2FsYSRFbnVtZXJhdGlvbiQkdm1hcHEAfgAMeHAAAAArAAAAAAAAACtwcHBzcgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkhhc2hNYXAAAAAAAAAAAQMAAHhwdw0AAALuAAAAAAAAAAQAeHNxAH4ADncNAAAC7gAAAAEAAAAEAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAqcQB+AAR4c3IAEVRlc3QkRW51bSQkYW5vbiQxWUiOWYTWxdoCAAB4cQB+AAJxAH4ADXEAfgANcQB+AARxAH4ADQAAACpw")
+
+ // IndexedSeqLike#Elements
+ check(new immutable.Range(0, 1, 1).iterator)("rO0ABXNyAChzY2FsYS5jb2xsZWN0aW9uLkluZGV4ZWRTZXFMaWtlJEVsZW1lbnRzGF+1cBwmcx0CAANJAANlbmRJAAVpbmRleEwABiRvdXRlcnQAIUxzY2FsYS9jb2xsZWN0aW9uL0luZGV4ZWRTZXFMaWtlO3hwAAAAAQAAAABzcgAgc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuUmFuZ2Vpu6NUqxUyDQIAB0kAA2VuZFoAB2lzRW1wdHlJAAtsYXN0RWxlbWVudEkAEG51bVJhbmdlRWxlbWVudHNJAAVzdGFydEkABHN0ZXBJAA90ZXJtaW5hbEVsZW1lbnR4cAAAAAEAAAAAAAAAAAEAAAAAAAAAAQAAAAE="
+ , _.toList)
+
+ check(new collection.concurrent.TrieMap[Any, Any]())( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmNvbmN1cnJlbnQuVHJpZU1hcKckxpgOIYHPAwAETAALZXF1YWxpdHlvYmp0ABJMc2NhbGEvbWF0aC9FcXVpdjtMAApoYXNoaW5nb2JqdAAcTHNjYWxhL3V0aWwvaGFzaGluZy9IYXNoaW5nO0wABHJvb3R0ABJMamF2YS9sYW5nL09iamVjdDtMAAtyb290dXBkYXRlcnQAOUxqYXZhL3V0aWwvY29uY3VycmVudC9hdG9taWMvQXRvbWljUmVmZXJlbmNlRmllbGRVcGRhdGVyO3hwc3IAMnNjYWxhLmNvbGxlY3Rpb24uY29uY3VycmVudC5UcmllTWFwJE1hbmdsZWRIYXNoaW5nhTBoJQ/mgb0CAAB4cHNyABhzY2FsYS5tYXRoLkVxdWl2JCRhbm9uJDLBbyx4dy/qGwIAAHhwc3IANHNjYWxhLmNvbGxlY3Rpb24uY29uY3VycmVudC5UcmllTWFwU2VyaWFsaXphdGlvbkVuZCSbjdgbbGCt2gIAAHhweA==")
+ // not sure why this one needs stable serialization.
+ check(collection.convert.Wrappers)( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW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ZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcA==")
+
+ check(immutable.BitSet(1, 2, 3))( "rO0ABXNyAClzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5CaXRTZXQkQml0U2V0MR9dg8JGRI8UAgABSgAFZWxlbXN4cgAhc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuQml0U2V0Flz5Ms3qxsoCAAB4cAAAAAAAAAAO")
+ check(immutable.HashMap())( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoTWFwJFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAB4")
+ check(immutable.HashMap(1 -> 2))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoTWFwJFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
+ check(immutable.HashMap(1 -> 2, 3 -> 4))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoTWFwJFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAJzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADc3EAfgACAAAABHg=")
+ // TODO provoke HashMapCollision1
+
+ check(immutable.HashSet())( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAB4")
+ check(immutable.HashSet(1))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXg=")
+ check(immutable.HashSet(1, 2))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAJzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
+ check(immutable.HashSet(1, 2, 3))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADeA==")
+ // TODO provoke HashSetCollision1
+
+ check(immutable.ListMap())( "rO0AB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uhAgACTAACaW50ACFMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvTGlzdDtMAANvdXRxAH4AAXhwc3IAMnNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3QkU2VyaWFsaXphdGlvblByb3h5AAAAAAAAAAEDAAB4cHNyACxzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0U2VyaWFsaXplRW5kJIpcY1v3UwttAgAAeHB4c3EAfgADc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAgAAAACc3EAfgAIAAAAA3EAfgAGeA==")
+
+ check(new immutable.Range(0, 1, 1))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5SYW5nZWm7o1SrFTINAgAHSQADZW5kWgAHaXNFbXB0eUkAC2xhc3RFbGVtZW50SQAQbnVtUmFuZ2VFbGVtZW50c0kABXN0YXJ0SQAEc3RlcEkAD3Rlcm1pbmFsRWxlbWVudHhwAAAAAQAAAAAAAAAAAQAAAAAAAAABAAAAAQ==")
+
+ check(immutable.Set())( "rO0ABXNyAChzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkRW1wdHlTZXQk8Hk3TFN0uDYCAAB4cA==")
+ check(immutable.Set(1))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0MREd3c4yqtWTAgABTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDt4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAB")
+ check(immutable.Set(1, 2))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0MqaV02sZQzV0AgACTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAwAAAAI=")
+ check(immutable.Set(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0M84syT0560SgAgADTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABTAAFZWxlbTNxAH4AAXhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAMAAAACc3EAfgADAAAAAw==")
+ check(immutable.Set(1, 2, 3, 4))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0NM26psRRbei1AgAETAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABTAAFZWxlbTNxAH4AAUwABWVsZW00cQB+AAF4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgADAAAAAnNxAH4AAwAAAANzcQB+AAMAAAAE")
+ check(immutable.Set(1, 2, 3, 4, 5))( "rO0ABXNyADVzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5IYXNoU2V0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAACAwAAeHB3BAAAAAVzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAABXNxAH4AAgAAAAFzcQB+AAIAAAACc3EAfgACAAAAA3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AAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAnNxAH4ABgAAAAFzcQB+AAoAAAABcHBzcgAXc2NhbGEucnVudGltZS5Cb3hlZFVuaXR0pn1HHezLmgIAAHhwc3EAfgAGAAAAAXNxAH4ACgAAAANwcHEAfgAQcQB+ABA=")
+
+ check(mutable.ArrayBuffer(1, 2, 3))( "rO0ABXNyACRzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlCdWZmZXIVOLBTg4KOcwIAA0kAC2luaXRpYWxTaXplSQAFc2l6ZTBbAAVhcnJheXQAE1tMamF2YS9sYW5nL09iamVjdDt4cAAAABAAAAADdXIAE1tMamF2YS5sYW5nLk9iamVjdDuQzlifEHMpbAIAAHhwAAAAEHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgAFAAAAAnNxAH4ABQAAAANwcHBwcHBwcHBwcHBw")
+ check(mutable.ArraySeq(1, 2, 3))( "rO0ABXNyACFzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlTZXEVPD3SKEkOcwIAAkkABmxlbmd0aFsABWFycmF5dAATW0xqYXZhL2xhbmcvT2JqZWN0O3hwAAAAA3VyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABQAAAAJzcQB+AAUAAAAD")
+ check(mutable.ArrayStack(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuQXJyYXlTdGFja3bdxXbcnLBeAgACSQAqc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJEFycmF5U3RhY2skJGluZGV4WwAqc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJEFycmF5U3RhY2skJHRhYmxldAATW0xqYXZhL2xhbmcvT2JqZWN0O3hwAAAAA3VyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAA3NxAH4ABQAAAAJzcQB+AAUAAAAB")
+ check(mutable.DoubleLinkedList(1, 2, 3))( "rO0ABXNyAClzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuRG91YmxlTGlua2VkTGlzdI73LKsKRr1RAgADTAAEZWxlbXQAEkxqYXZhL2xhbmcvT2JqZWN0O0wABG5leHR0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1NlcTtMAARwcmV2cQB+AAJ4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABc3EAfgAAc3EAfgAEAAAAAnNxAH4AAHNxAH4ABAAAAANzcQB+AABwcQB+AAtxAH4ACXEAfgAHcQB+AANw")
+
+ check(mutable.HashMap())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAAAAAAABAB4")
+ check(mutable.HashMap(1 -> 1))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXEAfgAEeA==")
+ check(mutable.HashSet(1, 2, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaFNldAAAAAAAAAABAwAAeHB3DQAAAcIAAAADAAAABQBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADeA==")
+ check(new mutable.History())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGlzdG9yeUhuXxDIFJrsAgACSQAKbWF4SGlzdG9yeUwAA2xvZ3QAIExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUXVldWU7eHAAAAPoc3IAHnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5RdWV1ZbjMURVfOuHHAgAAeHIAJHNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5NdXRhYmxlTGlzdFJpnjJ+gFbAAgADSQADbGVuTAAGZmlyc3QwdAAlTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9MaW5rZWRMaXN0O0wABWxhc3QwcQB+AAV4cAAAAABzcgAjc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkxpbmtlZExpc3Sak+nGCZHaUQIAAkwABGVsZW10ABJMamF2YS9sYW5nL09iamVjdDtMAARuZXh0dAAeTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9TZXE7eHBwcQB+AApxAH4ACg==")
+ check(mutable.LinkedHashMap(1 -> 2))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlua2VkSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
+ check(mutable.LinkedHashSet(1, 2, 3))( "rO0ABXNyACZzY2FsYS5jb2xsZW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N4")
+ check(new mutable.StringBuilder(new java.lang.StringBuilder("123")))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuU3RyaW5nQnVpbGRlcomvqgGv1tTxAgABTAAKdW5kZXJseWluZ3QAGUxqYXZhL2xhbmcvU3RyaW5nQnVpbGRlcjt4cHNyABdqYXZhLmxhbmcuU3RyaW5nQnVpbGRlcjzV+xRaTGrLAwAAeHB3BAAAAAN1cgACW0OwJmaw4l2ErAIAAHhwAAAAEwAxADIAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeA==")
+ check(mutable.UnrolledBuffer[Int]())( "rO0ABXNyACdzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVW5yb2xsZWRCdWZmZXIAAAAAAAAAAQMAAUwAA3RhZ3QAGExzY2FsYS9yZWZsZWN0L0NsYXNzVGFnO3hwc3IAJXNjYWxhLnJlZmxlY3QuTWFuaWZlc3RGYWN0b3J5JCRhbm9uJDnN+aJJU2O1UgIAAHhyABxzY2FsYS5yZWZsZWN0LkFueVZhbE1hbmlmZXN0AAAAAAAAAAECAAFMAAh0b1N0cmluZ3QAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAADSW50dwQAAAAAeA==")
+
+ import collection.parallel
+ check(parallel.immutable.ParHashMap(1 -> 2))( "rO0ABXNyAC5zY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLmltbXV0YWJsZS5QYXJIYXNoTWFwAAAAAAAAAAECAANMAA9TY2FuTGVhZiRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2NhbkxlYWYkO0wAD1NjYW5Ob2RlJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL3BhcmFsbGVsL1Bhckl0ZXJhYmxlTGlrZSRTY2FuTm9kZSQ7TAAEdHJpZXQAJExzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS9IYXNoTWFw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MZWFmJDtMAA9TY2FuTm9kZSRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2Nhbk5vZGUkO3hwcHB3DQAAAcIAAAADAAAAGwFzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABAAAAAJzcQB+AAQAAAADeA==")
+
+ check("...".r)("rO0ABXNyABlzY2FsYS51dGlsLm1hdGNoaW5nLlJlZ2V44u3Vap7wIb8CAAJMAAdwYXR0ZXJudAAZTGphdmEvdXRpbC9yZWdleC9QYXR0ZXJuO0wAJXNjYWxhJHV0aWwkbWF0Y2hpbmckUmVnZXgkJGdyb3VwTmFtZXN0ABZMc2NhbGEvY29sbGVjdGlvbi9TZXE7eHBzcgAXamF2YS51dGlsLnJlZ2V4LlBhdHRlcm5GZ9VrbkkCDQIAAkkABWZsYWdzTAAHcGF0dGVybnQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwAAAAAHQAAy4uLnNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgAsc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdFNlcmlhbGl6ZUVuZCSKXGNb91MLbQIAAHhweA==",
+ r => (r.toString))
+}
diff --git a/test/files/run/t8549b.scala b/test/files/run/t8549b.scala
new file mode 100644
index 0000000000..1e1bf2c0bc
--- /dev/null
+++ b/test/files/run/t8549b.scala
@@ -0,0 +1,16 @@
+
+@SerialVersionUID(42)
+class C
+
+@SerialVersionUID(43 - 1)
+class D
+
+
+object Test extends App {
+ def checkId(cls: Class[_]) {
+ val id = cls.getDeclaredField("serialVersionUID").get(null)
+ assert(id == 42, (cls, id))
+ }
+ checkId(classOf[C])
+ checkId(classOf[D])
+}
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
index fdb0d83277..fd810674f5 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
@@ -9,7 +9,7 @@ object DefinitionConstructionProps
with ValDefConstruction
with PatDefConstruction
with DefConstruction
- with PackageConstruction
+ with PackageConstruction
with ImportConstruction {
val x: Tree = q"val x: Int"
@@ -81,6 +81,24 @@ trait ClassConstruction { self: QuasiquoteProperties =>
assertEqAst(q" class C($privx)", " class C(x: Int) ")
assertEqAst(q"case class C($privx)", "case class C(private[this] val x: Int)")
}
+
+ property("SI-8333") = test {
+ assertEqAst(q"{ $NoMods class C }", "{ class C }")
+ }
+
+ property("SI-8332") = test {
+ val args = q"val a: Int; val b: Int"
+ assertEqAst(q"class C(implicit ..$args)", "class C(implicit val a: Int, val b: Int)")
+ }
+
+ property("SI-8451: inline secondary constructors") = test {
+ assertEqAst(q"class C(x: Int) { def this() = this(0) }", "class C(x: Int) { def this() = this(0) }")
+ }
+
+ property("SI-8451: unquoted secondary constructors") = test {
+ val secondaryCtor = q"def this() = this(0)"
+ assertEqAst(q"class C(x: Int) { $secondaryCtor }", "class C(x: Int) { def this() = this(0) }")
+ }
}
trait TraitConstruction { self: QuasiquoteProperties =>
diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
index 996ac65b36..2c0e100b5a 100644
--- a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
@@ -73,8 +73,11 @@ trait ClassDeconstruction { self: QuasiquoteProperties =>
property("exhaustive class matcher") = test {
def matches(line: String) {
- val q"""$classMods class $name[..$targs] $ctorMods(...$argss)
- extends { ..$early } with ..$parents { $self => ..$body }""" = parse(line)
+ val tree = parse(line)
+ val q"""$classMods0 class $name0[..$targs0] $ctorMods0(...$argss0)
+ extends { ..$early0 } with ..$parents0 { $self0 => ..$body0 }""" = tree
+ val q"""$classMods1 class $name1[..$targs1] $ctorMods1(...$argss1)(implicit ..$impl)
+ extends { ..$early1 } with ..$parents1 { $self1 => ..$body1 }""" = tree
}
matches("class Foo")
matches("class Foo[T]")
@@ -106,6 +109,13 @@ trait ClassDeconstruction { self: QuasiquoteProperties =>
Ident(TypeName("Int")), EmptyTree))), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(())))))))
}
}
+
+ property("SI-8332") = test {
+ val q"class C(implicit ..$args)" = q"class C(implicit i: I, j: J)"
+ val q"$imods val i: I" :: q"$jmods val j: J" :: Nil = args
+ assert(imods.hasFlag(IMPLICIT))
+ assert(jmods.hasFlag(IMPLICIT))
+ }
}
trait ModsDeconstruction { self: QuasiquoteProperties =>
@@ -219,6 +229,12 @@ trait DefDeconstruction { self: QuasiquoteProperties =>
val q"def foo(...$argss)(implicit ..$impl)" = q"def foo(x: Int)"
assert(impl.isEmpty)
}
+
+ property("SI-8451") = test {
+ val q"def this(..$params) = this(..$args)" = q"def this(x: Int) = this(0)"
+ assert(params ≈ List(q"${Modifiers(PARAM)} val x: Int"))
+ assert(args ≈ List(q"0"))
+ }
}
trait ImportDeconstruction { self: QuasiquoteProperties =>
diff --git a/test/files/scalacheck/quasiquotes/ErrorProps.scala b/test/files/scalacheck/quasiquotes/ErrorProps.scala
index d61119d98f..2cba07abf2 100644
--- a/test/files/scalacheck/quasiquotes/ErrorProps.scala
+++ b/test/files/scalacheck/quasiquotes/ErrorProps.scala
@@ -9,9 +9,10 @@ object ErrorProps extends QuasiquoteProperties("errors") {
""")
property("can't unquote with given rank") = fails(
- "Can't unquote List[reflect.runtime.universe.Ident], consider using ..",
+ "Can't unquote List[StringBuilder], consider using .. or providing an implicit instance of Liftable[List[StringBuilder]]",
"""
- val xs = List(q"x", q"x")
+ import java.lang.StringBuilder
+ val xs: List[StringBuilder] = Nil
q"$xs"
""")
@@ -71,9 +72,10 @@ object ErrorProps extends QuasiquoteProperties("errors") {
""")
property("use ... rank or provide liftable") = fails(
- "Can't unquote List[List[reflect.runtime.universe.Ident]], consider using ...",
+ "Can't unquote List[List[StringBuilder]], consider using ... or providing an implicit instance of Liftable[List[List[StringBuilder]]]",
"""
- val xs = List(List(q"x", q"x"))
+ import java.lang.StringBuilder
+ val xs: List[List[StringBuilder]] = Nil
q"$xs"
""")
@@ -160,6 +162,52 @@ object ErrorProps extends QuasiquoteProperties("errors") {
q"$n"
""")
+ property("SI-8211: check unbound placeholder paremeters") = fails(
+ "unbound placeholder parameter",
+ """
+ q"_"
+ """)
+
+ property("SI-8211: check unbound wildcard types") = fails(
+ "unbound wildcard type",
+ """
+ tq"_"
+ """)
+
+ property("SI-8420: don't crash on splicing of non-unliftable native type (1)") = fails(
+ "Can't unquote List[reflect.runtime.universe.Symbol] with .., consider omitting the dots or providing an implicit instance of Liftable[reflect.runtime.universe.Symbol]",
+ """
+ val l: List[Symbol] = Nil
+ q"f(..$l)"
+ """)
+
+ property("SI-8420: don't crash on splicing of non-unliftable native type (2)") = fails(
+ "Can't unquote List[reflect.runtime.universe.FlagSet] with .., consider omitting the dots or providing an implicit instance of Liftable[reflect.runtime.universe.FlagSet]",
+ """
+ val l: List[FlagSet] = Nil
+ q"f(..$l)"
+ """)
+
+ property("SI-8420: don't crash on splicing of non-unliftable native type (3)") = fails(
+ "Can't unquote List[reflect.runtime.universe.Modifiers] with .., consider omitting the dots or providing an implicit instance of Liftable[reflect.runtime.universe.Modifiers]",
+ """
+ val l: List[Modifiers] = Nil
+ q"f(..$l)"
+ """)
+
+ property("SI-8451 construction: disallow everything except for constructor calls in secondary constructor bodies") = fails(
+ "'this' expected but unquotee found",
+ """
+ val rhs1 = q"this(0)"
+ val ctor1 = q"def this(x: Int) = $rhs1"
+ """)
+
+ property("SI-8451 deconstruction: disallow everything except for constructor calls in secondary constructor bodies") = fails(
+ "'this' expected but unquotee found",
+ """
+ val q"def this(..$params) = $rhs2" = q"def this(x: Int) = this(0)"
+ """)
+
// // Make sure a nice error is reported in this case
// { import Flag._; val mods = NoMods; q"lazy $mods val x: Int" }
}
diff --git a/test/files/scalacheck/quasiquotes/LiftableProps.scala b/test/files/scalacheck/quasiquotes/LiftableProps.scala
index 5d0eeb53c6..a4c57ac359 100644
--- a/test/files/scalacheck/quasiquotes/LiftableProps.scala
+++ b/test/files/scalacheck/quasiquotes/LiftableProps.scala
@@ -88,9 +88,10 @@ object LiftableProps extends QuasiquoteProperties("liftable") {
assert(q"$const" ≈ q"0")
}
+ val immutable = q"$scalapkg.collection.immutable"
+
property("lift list variants") = test {
val lst = List(1, 2)
- val immutable = q"$scalapkg.collection.immutable"
assert(q"$lst" ≈ q"$immutable.List(1, 2)")
assert(q"f(..$lst)" ≈ q"f(1, 2)")
val llst = List(List(1), List(2))
@@ -98,6 +99,11 @@ object LiftableProps extends QuasiquoteProperties("liftable") {
assert(q"f(...$llst)" ≈ q"f(1)(2)")
}
+ property("lift list of tree") = test {
+ val lst = List(q"a", q"b")
+ assert(q"$lst" ≈ q"$immutable.List(a, b)")
+ }
+
property("lift tuple") = test {
assert(q"${(1, 2)}" ≈ q"(1, 2)")
assert(q"${(1, 2, 3)}" ≈ q"(1, 2, 3)")
@@ -158,4 +164,11 @@ object LiftableProps extends QuasiquoteProperties("liftable") {
val right3: Either[Int, Int] = Right(1)
assert(q"$right3" ≈ q"scala.util.Right(1)")
}
+
+ property("lift xml comment") = test {
+ implicit val liftXmlComment = Liftable[xml.Comment] { comment =>
+ q"new _root_.scala.xml.Comment(${comment.commentText})"
+ }
+ assert(q"${xml.Comment("foo")}" ≈ q"<!--foo-->")
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index 10ce1604b1..45392de582 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -95,15 +95,9 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
body1 ≈ body && cond1 ≈ cond
}
- property("unquote trees into alternative") = forAll { (c: Tree, A: Tree, B: Tree) =>
- q"$c match { case $A | $B => }" ≈
- Match(c, List(
- CaseDef(Alternative(List(A, B)), EmptyTree, Literal(Constant(())))))
- }
-
def blockInvariant(quote: Tree, trees: List[Tree]) =
quote ≈ (trees match {
- case Nil => q""
+ case Nil => q"{}"
case _ :+ last if !last.isTerm => Block(trees, q"()")
case head :: Nil => head
case init :+ last => Block(init, last)
@@ -277,15 +271,43 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
assert(stats ≈ List(q"def x = 2", q"()"))
}
- property("empty-tree as block") = test {
- val q"{ ..$stats1 }" = q" "
- assert(stats1.isEmpty)
- val stats2 = List.empty[Tree]
- assert(q"{ ..$stats2 }" ≈ q"")
+ property("empty-tree is not a block") = test {
+ assertThrows[MatchError] {
+ val q"{ ..$stats1 }" = q" "
+ }
+ }
+
+ property("empty block is synthetic unit") = test {
+ val q"()" = q"{}"
+ val q"{..$stats}" = q"{}"
+ assert(stats.isEmpty)
+ assertEqAst(q"{..$stats}", "{}")
+ assertEqAst(q"{..$stats}", "()")
}
property("consistent variable order") = test {
val q"$a = $b = $c = $d = $e = $f = $g = $h = $k = $l" = q"a = b = c = d = e = f = g = h = k = l"
assert(a ≈ q"a" && b ≈ q"b" && c ≈ q"c" && d ≈ q"d" && e ≈ q"e" && g ≈ q"g" && h ≈ q"h" && k ≈ q"k" && l ≈ q"l")
}
+
+ property("SI-8385 a") = test {
+ assertEqAst(q"(foo.x = 1)(2)", "(foo.x = 1)(2)")
+ }
+
+ property("SI-8385 b") = test {
+ assertEqAst(q"(() => ())()", "(() => ())()")
+ }
+
+ property("match scrutinee may not be empty") = test {
+ assertThrows[IllegalArgumentException] {
+ val scrutinee = q""
+ val cases = List(cq"_ =>")
+ q"$scrutinee match { case ..$cases }"
+ }
+ }
+
+ property("construct partial function") = test {
+ val cases = List(cq"a => b", cq"c => d")
+ assertEqAst(q"{ case ..$cases }", "{ case a => b case c => d }")
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 7c9b5ead20..49ffaff630 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -175,4 +175,75 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
assert(x ≈ q"x")
val q"{ _ * _ }" = q"{ _ * _ }"
}
+
+ property("si-8275 a") = test {
+ val cq"_ => ..$stats" = cq"_ => foo; bar"
+ assert(stats ≈ List(q"foo", q"bar"))
+ }
+
+ property("si-8275 b") = test {
+ val cq"_ => ..$init; $last" = cq"_ => a; b; c"
+ assert(init ≈ List(q"a", q"b"))
+ assert(last ≈ q"c")
+ }
+
+ property("si-8275 c") = test {
+ val cq"_ => ..$stats" = cq"_ =>"
+ assert(stats.isEmpty)
+ assertEqAst(q"{ case _ => ..$stats }", "{ case _ => }")
+ }
+
+ property("can't flatten type into block") = test {
+ assertThrows[IllegalArgumentException] {
+ val tpt = tq"List[Int]"
+ q"..$tpt; ()"
+ }
+ }
+
+ property("term select doesn't match type select") = test {
+ assertThrows[MatchError] {
+ val q"$qual.$name" = tq"foo.bar"
+ }
+ }
+
+ property("type application doesn't match applied type") = test {
+ assertThrows[MatchError] {
+ val q"$f[..$targs]" = tq"foo[bar]"
+ }
+ }
+
+ property("match doesn't match partial function") = test {
+ assertThrows[MatchError] {
+ val q"$_ match { case ..$_ }" = q"{ case _ => }"
+ }
+ }
+
+ property("deconstruct partial function") = test {
+ val q"{ case ..$cases }" = q"{ case a => b case c => d }"
+ val List(cq"a => b", cq"c => d") = cases
+ }
+
+ property("SI-8350 `new C` and `new C()` are equivalent") = test {
+ val q"new C" = q"new C()"
+ val q"new C()" = q"new C"
+ }
+
+ property("SI-8350 new applications extracted only for non-empty ctor calls") = test{
+ val q"new $c1" = q"new C()"
+ assert(c1 ≈ tq"C")
+ val q"new $c2" = q"new C(x)"
+ assert(c2 ≈ q"${tq"C"}(x)")
+ }
+
+ property("SI-8350 original test case") = test {
+ val q"new ..$parents" = q"new Foo with Bar"
+ assert(parents ≈ List(tq"Foo", tq"Bar"))
+ }
+
+ property("SI-8387 new is not an application") = test {
+ val `new` = q"new F(x)"
+ val q"$f(...$argss)" = `new`
+ assert(f ≈ `new`)
+ assert(argss.isEmpty)
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
index 8ec1779353..7572b27b52 100644
--- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
@@ -63,4 +63,16 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction
// matches because type tree isn't syntactic without original
val tq"" = tq"${typeOf[Int]}"
}
+
+ property("type select doesn't match term select") = test {
+ assertThrows[MatchError] {
+ val tq"$qual.$name" = q"foo.bar"
+ }
+ }
+
+ property("applied type doesn't match type appliction") = test {
+ assertThrows[MatchError] {
+ val tq"$tpt[..$tpts]" = q"foo[bar]"
+ }
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
index 7c4cb0306e..f84df269ca 100644
--- a/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypecheckedProps.scala
@@ -1,33 +1,13 @@
import org.scalacheck._, Prop._, Gen._, Arbitrary._
import scala.reflect.runtime.universe._, Flag._, internal.reificationSupport._
-object TypecheckedProps extends QuasiquoteProperties("typechecked") {
- def original(tree: Tree) = tree match {
- case tt: TypeTree => Some(tt.original)
- case _ => None
- }
- def originals(trees: List[Tree]) = trees.flatMap(original)
- val int = ScalaDot(TypeName("Int"))
- val intint = List(int, int)
-
+object TypecheckedProps extends QuasiquoteProperties("typechecked")
+ with TypecheckedTypes {
property("tuple term") = test {
val q"(..$elements)" = typecheck(q"(1, 2)")
assert(elements ≈ List(q"1", q"2"))
}
- property("tuple type") = test {
- val tq"(..$els0)" = typecheckTyp(tq"Unit")
- assert(els0.isEmpty)
- val tq"(..$els1)" = typecheckTyp(tq"(Int, Int)")
- assert(originals(els1) ≈ intint)
- }
-
- property("function type") = test {
- val tq"(..$argtpes) => $restpe" = typecheckTyp(tq"(Int, Int) => Int")
- assert(originals(argtpes) ≈ intint)
- assert(original(restpe).get ≈ int)
- }
-
property("for/for-yield") = test {
val enums = fq"x <- xs" :: fq"x1 = x + 1" :: fq"if x1 % 2 == 0" :: Nil
val body = q"x1"
@@ -152,4 +132,84 @@ object TypecheckedProps extends QuasiquoteProperties("typechecked") {
assert(name == defName)
assert(rhs ≈ defRhs)
}
+
+ property("partial function") = test {
+ val q"{ case ..$cases }: $ascr" = typecheck(q"{ case 1 => () }: PartialFunction[Int, Unit]")
+ assert(cases ≈ q"{ case 1 => () }".cases)
+ }
+}
+
+trait TypecheckedTypes { self: QuasiquoteProperties =>
+ property("type ident") = test {
+ val q"$_; type $_ = $tpt" = typecheck(q"class C; type T = C")
+ val tq"C" = tpt
+ }
+
+ property("type select") = test {
+ val tq"scala.Int" = typecheckTyp(tq"Int")
+ }
+
+ property("this type select") = test {
+ val q"class $_ { $_; type $_ = $tpt }" = typecheck(q"class C { type A = Int; type B = this.A }")
+ val tq"this.$name" = tpt
+ val TypeName("A") = name
+ }
+
+ property("super type select") = test {
+ val q"$_; class $_ extends $_ { type $_ = $tpt }" =
+ typecheck(q"class C1 { type A = Int }; class C2 extends C1 { type B = super[C1].A }")
+ val tq"$empty.super[$c1].$a" = tpt
+ val TypeName("") = empty
+ val TypeName("C1") = c1
+ val TypeName("A") = a
+ }
+
+ property("applied type") = test {
+ val tt = typecheckTyp(tq"Map[Int, Int]")
+ val tq"$tpt[..$tpts]" = tt
+ val tq"scala.this.Predef.Map" = tpt
+ val List(tq"scala.Int", tq"scala.Int") = tpts
+ }
+
+ property("tuple type") = test {
+ val tq"(..$els0)" = typecheckTyp(tq"Unit")
+ assert(els0.isEmpty)
+ val tq"(..$els1)" = typecheckTyp(tq"(Int, Int)")
+ val List(tq"scala.Int", tq"scala.Int") = els1
+ }
+
+ property("function type") = test {
+ val tq"(..$argtpes) => $restpe" = typecheckTyp(tq"(Int, Int) => Int")
+ val List(tq"scala.Int", tq"scala.Int") = argtpes
+ val tq"scala.Int" = restpe
+ }
+
+ property("compound type") = test {
+ val tq"..$parents { ..$defns }" = typecheckTyp(tq"Int { def x: Int }")
+ val List(tq"Int") = parents
+ val List(q"def x: Int") = defns
+ }
+
+ property("singleton type") = test {
+ val tq"$ref.type" = typecheckTyp(tq"scala.Predef.type")
+ val q"scala.Predef" = ref
+ }
+
+ property("type projection") = test {
+ val tq"$tpt#$name" = typecheckTyp(tq"({ type T = Int })#T")
+ val TypeName("T") = name
+ val tq"{ type T = Int }" = tpt
+ }
+
+ property("annotated type") = test {
+ val tq"$tpt @$annot" = typecheckTyp(tq"Int @unchecked")
+ val tq"scala.Int" = tpt
+ val tq"unchecked" = annot
+ }
+
+ property("existential type") = test {
+ val tq"$tpt forSome { ..$defns }" = typecheckTyp(tq"T forSome { type T }")
+ val tq"T" = tpt
+ val q"type T" :: Nil = defns
+ }
}
diff --git a/test/files/scalacheck/quasiquotes/UnliftableProps.scala b/test/files/scalacheck/quasiquotes/UnliftableProps.scala
index 1d7629aa29..659b18edab 100644
--- a/test/files/scalacheck/quasiquotes/UnliftableProps.scala
+++ b/test/files/scalacheck/quasiquotes/UnliftableProps.scala
@@ -155,4 +155,12 @@ object UnliftableProps extends QuasiquoteProperties("unliftable") {
assert(t21 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21))
assert(t22 == (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22))
}
+
+ property("unlift xml comment") = test {
+ implicit val unliftXmlComment = Unliftable[xml.Comment] {
+ case q"new _root_.scala.xml.Comment(${value: String})" => xml.Comment(value)
+ }
+ val q"${comment: xml.Comment}" = q"<!--foo-->"
+ assert(comment.commentText == "foo")
+ }
}
diff --git a/test/junit/scala/collection/convert/MapWrapperTest.scala b/test/junit/scala/collection/convert/MapWrapperTest.scala
index 060b6b5937..22eaf858ea 100644
--- a/test/junit/scala/collection/convert/MapWrapperTest.scala
+++ b/test/junit/scala/collection/convert/MapWrapperTest.scala
@@ -46,4 +46,14 @@ class MapWrapperTest {
assertFalse(javaMap.containsKey(null)) // negative test, null key
assertEquals(4, scalaMap.containsCounter)
}
+
+ // test for SI-8504
+ @Test
+ def testHashCode() {
+ import scala.collection.JavaConverters._
+ val javaMap = Map(1 -> null).asJava
+
+ // Before the fix for SI-8504, this throws a NPE
+ javaMap.hashCode
+ }
}
diff --git a/test/junit/scala/reflect/internal/MirrorsTest.scala b/test/junit/scala/reflect/internal/MirrorsTest.scala
index 8f2a92f27a..9108af139f 100644
--- a/test/junit/scala/reflect/internal/MirrorsTest.scala
+++ b/test/junit/scala/reflect/internal/MirrorsTest.scala
@@ -1,22 +1,18 @@
-// looks like tests are compiled by the old version of compiler
-// therefore certain scala-reflect tests give me AMEs after the SI-8063 overhaul
-// TODO: fix this in build.xml
+package scala.reflect.internal
-// package scala.reflect.internal
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
-// import org.junit.Assert._
-// import org.junit.Test
-// import org.junit.runner.RunWith
-// import org.junit.runners.JUnit4
-
-// @RunWith(classOf[JUnit4])
-// class MirrorsTest {
-// @Test def rootCompanionsAreConnected(): Unit = {
-// val cm = scala.reflect.runtime.currentMirror
-// import cm._
-// assertEquals("RootPackage.moduleClass == RootClass", RootClass, RootPackage.moduleClass)
-// assertEquals("RootClass.module == RootPackage", RootPackage, RootClass.module)
-// assertEquals("EmptyPackage.moduleClass == EmptyPackageClass", EmptyPackageClass, EmptyPackage.moduleClass)
-// assertEquals("EmptyPackageClass.module == EmptyPackage", EmptyPackage, EmptyPackageClass.module)
-// }
-// } \ No newline at end of file
+@RunWith(classOf[JUnit4])
+class MirrorsTest {
+ @Test def rootCompanionsAreConnected(): Unit = {
+ val cm = scala.reflect.runtime.currentMirror
+ import cm._
+ assertEquals("RootPackage.moduleClass == RootClass", RootClass, RootPackage.moduleClass)
+ assertEquals("RootClass.module == RootPackage", RootPackage, RootClass.module)
+ assertEquals("EmptyPackage.moduleClass == EmptyPackageClass", EmptyPackageClass, EmptyPackage.moduleClass)
+ assertEquals("EmptyPackageClass.module == EmptyPackage", EmptyPackage, EmptyPackageClass.module)
+ }
+} \ No newline at end of file
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala
index 62cb401aa9..4587417a99 100644
--- a/test/junit/scala/reflect/internal/PrintersTest.scala
+++ b/test/junit/scala/reflect/internal/PrintersTest.scala
@@ -1,824 +1,1164 @@
-// looks like tests are compiled by the old version of compiler
-// therefore certain scala-reflect tests give me AMEs after the SI-8063 overhaul
-// TODO: fix this in build.xml
+package scala.reflect.internal
-// package scala.reflect.internal
+import org.junit.Test
+import org.junit.Assert._
+import scala.tools.reflect._
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror=>cm}
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
-// import org.junit.Test
-// import org.junit.Assert._
-// import scala.tools.reflect._
-// import scala.reflect.runtime.universe._
-// import scala.reflect.runtime.{currentMirror=>cm}
-// import org.junit.runner.RunWith
-// import org.junit.runners.JUnit4
+@RunWith(classOf[JUnit4])
+class PrintersTest extends BasePrintTests
+ with ClassPrintTests
+ with TraitPrintTests
+ with ValAndDefPrintTests
+ with QuasiTreesPrintTests
+ with PackagePrintTests
-// @RunWith(classOf[JUnit4])
-// class PrintersTest extends BasePrintTests
-// with ClassPrintTests
-// with TraitPrintTests
-// with ValAndDefPrintTests
-// with QuasiTreesPrintTests
-// with PackagePrintTests
+object PrinterHelper {
+ val toolbox = cm.mkToolBox()
-// object PrinterHelper {
-// val toolbox = cm.mkToolBox()
-// def assertPrintedCode(code: String, tree: Tree = EmptyTree) = {
-// def processEOL(resultCode: String) = {
-// import scala.reflect.internal.Chars._
-// resultCode.replaceAll(s"$CR$LF", s"$LF").replace(CR, LF)
-// }
+ import scala.reflect.internal.Chars._
+ private def normalizeEOL(resultCode: String) =
+ resultCode.lines mkString s"$LF"
-// val toolboxTree =
-// try{
-// toolbox.parse(code)
-// } catch {
-// case e:scala.tools.reflect.ToolBoxError => throw new Exception(e.getMessage + ": " + code)
-// }
-// if (tree ne EmptyTree) assertEquals("using quasiquote or given tree"+"\n", code.trim, processEOL(showCode(tree)))
-// else assertEquals("using toolbox parser", code.trim, processEOL(showCode(toolboxTree)))
-// }
+ def assertResultCode(code: String)(parsedCode: String = "", typedCode: String = "", wrap: Boolean = false, printRoot: Boolean = false) = {
+ def toolboxTree(tree: => Tree) = try{
+ tree
+ } catch {
+ case e:scala.tools.reflect.ToolBoxError => throw new Exception(e.getMessage + ": " + code)
+ }
-// implicit class StrContextStripMarginOps(val stringContext: StringContext) extends util.StripMarginInterpolator
-// }
+ def wrapCode(source: String) = {
+ val context = sm"""
+ |trait PrintersContext {
+ | class baz extends scala.annotation.StaticAnnotation;
+ | class foo1[A, B] extends scala.annotation.StaticAnnotation;
+ | class foo2[A, B](a: scala.Int)(b: scala.Int) extends scala.annotation.StaticAnnotation;
+ | class foo3[Af, Bf](a: scala.Int)(b: scala.Float, c: PrintersContext.this.foo1[Af, Bf]) extends scala.annotation.StaticAnnotation;
+ | trait A1;
+ | trait B1;
+ |${source.trim.lines map {" " + _} mkString s"$LF"}
+ |}"""
-// import PrinterHelper._
+ if (wrap) context.trim() else source.trim
+ }
-// trait BasePrintTests {
-// @Test def testIdent = assertPrintedCode("*", Ident("*"))
+ val parsedTree = toolboxTree(toolbox.parse(wrapCode(code)))
+ if (!parsedCode.isEmpty())
+ assertEquals("using toolbox parser" + LF, wrapCode(parsedCode), normalizeEOL(showCode(parsedTree)))
+ if (!typedCode.isEmpty()) {
+ val typedTree = toolboxTree(toolbox.typecheck(parsedTree))
+ assertEquals("using toolbox typechecker" + LF, wrapCode(typedCode), normalizeEOL(showCode(typedTree, printRootPkg = printRoot)))
+ }
+ }
-// @Test def testConstant1 = assertPrintedCode("\"*\"", Literal(Constant("*")))
+ def assertTreeCode(tree: Tree)(code: String) = {
+ assertEquals("using quasiquote or given tree"+LF, code.trim, normalizeEOL(showCode(tree)))
+ }
-// @Test def testConstant2 = assertPrintedCode("42", Literal(Constant(42)))
+ def assertPrintedCode(source: String, checkTypedTree: Boolean = true, wrapCode: Boolean = false) = {
+ if (checkTypedTree)
+ assertResultCode(source)(source, source, wrapCode)
+ else assertResultCode(source)(parsedCode = source, wrap = wrapCode)
+ }
-// @Test def testConstantFloat = assertPrintedCode("42.0F", Literal(Constant(42f)))
-
-// @Test def testConstantDouble = assertPrintedCode("42.0", Literal(Constant(42d)))
-
-// @Test def testConstantLong = assertPrintedCode("42L", Literal(Constant(42l)))
-
-// @Test def testOpExpr = assertPrintedCode("(5).+(4)")
-
-// @Test def testName1 = assertPrintedCode("class test")
-
-// @Test def testName2 = assertPrintedCode("class *")
-
-// @Test def testName4 = assertPrintedCode("class `a*`")
-
-// @Test def testName5 = assertPrintedCode("val :::: = 1")
-
-// @Test def testName6 = assertPrintedCode("val `::::t` = 1")
-
-// @Test def testName7 = assertPrintedCode("""class \/""")
-
-// @Test def testName8 = assertPrintedCode("""class \\\\""")
-
-// @Test def testName9 = assertPrintedCode("""class test_\/""")
-
-// @Test def testName10 = assertPrintedCode("""class `*_*`""")
-
-// @Test def testName11 = assertPrintedCode("""class `a_*`""")
-
-// @Test def testName12 = assertPrintedCode("""class `*_a`""")
-
-// @Test def testName13 = assertPrintedCode("""class a_a""")
-
-// @Test def testName14 = assertPrintedCode("val x$11 = 5")
-
-// @Test def testName15 = assertPrintedCode("class `[]`")
-
-// @Test def testName16 = assertPrintedCode("class `()`")
-
-// @Test def testName17 = assertPrintedCode("class `{}`")
-
-// @Test def testName18 = assertPrintedCode("class <>")
-
-// @Test def testName19 = assertPrintedCode("""class `class`""")
-
-// @Test def testName20 = assertPrintedCode("""class `test name`""")
-
-// @Test def testIfExpr1 = assertPrintedCode(sm"""
-// |if (a)
-// | ((expr1): Int)
-// |else
-// | ((expr2): Int)""")
-
-// @Test def testIfExpr2 = assertPrintedCode(sm"""
-// |(if (a)
-// | {
-// | expr1;
-// | ()
-// | }
-// |else
-// | {
-// | expr2;
-// | ()
-// | }).toString""")
-
-// @Test def testIfExpr3 = assertPrintedCode(sm"""
-// |(if (a)
-// | {
-// | expr1;
-// | ()
-// | }
-// |else
-// | {
-// | expr2;
-// | ()
-// | }).method1().method2()""")
-
-// //val x = true && true && false.!
-// @Test def testBooleanExpr1 = assertPrintedCode("val x = true.&&(true).&&(false.!)")
-
-// //val x = true && !(true && false)
-// @Test def testBooleanExpr2 = assertPrintedCode("val x = true.&&(true.&&(false).`unary_!`)")
-
-// @Test def testNewExpr1 = assertPrintedCode("new foo()")
-
-// //new foo { test }
-// @Test def testNewExpr2 = assertPrintedCode(sm"""
-// |{
-// | final class $$anon extends foo {
-// | test
-// | };
-// | new $$anon()
-// |}""")
-
-// @Test def testNewExpr3 = assertPrintedCode("new foo[t]()")
-
-// @Test def testNewExpr4 = assertPrintedCode("new foo(x)")
-
-// @Test def testNewExpr5 = assertPrintedCode("new foo[t](x)")
-
-// //new foo[t](x) { () }
-// @Test def testNewExpr6 = assertPrintedCode(sm"""
-// |{
-// | final class $$anon extends foo[t](x) {
-// | ()
-// | };
-// | new $$anon()
-// |}""")
-
-// //new foo with bar
-// @Test def testNewExpr7 = assertPrintedCode(sm"""
-// |{
-// | final class $$anon extends foo with bar;
-// | new $$anon()
-// |}""")
-
-// //new { anonymous }
-// @Test def testNewExpr8 = assertPrintedCode(sm"""
-// |{
-// | final class $$anon {
-// | anonymous
-// | };
-// | new $$anon()
-// |}""")
-
-// //new { val early = 1 } with Parent[Int] { body }
-// @Test def testNewExpr9 = assertPrintedCode(sm"""
-// |{
-// | final class $$anon extends {
-// | val early = 1
-// | } with Parent[Int] {
-// | body
-// | };
-// | new $$anon()
-// |}""")
-
-// //new Foo { self => }
-// @Test def testNewExpr10 = assertPrintedCode(sm"""
-// |{
-// | final class $$anon extends Foo { self =>
-// |
-// | };
-// | new $$anon()
-// |}""")
-
-// @Test def testReturn = assertPrintedCode("def test: Int = return 42")
-
-// @Test def testFunc1 = assertPrintedCode("List(1, 2, 3).map(((i: Int) => i.-(1)))")
-
-// //val sum: Seq[Int] => Int = _ reduceLeft (_+_)
-// @Test def testFunc2 = assertPrintedCode("val sum: _root_.scala.Function1[Seq[Int], Int] = ((x$1) => x$1.reduceLeft(((x$2, x$3) => x$2.+(x$3))))")
-
-// //List(1, 2, 3) map (_ - 1)
-// @Test def testFunc3 = assertPrintedCode("List(1, 2, 3).map(((x$1) => x$1.-(1)))")
-
-// @Test def testImport1 = assertPrintedCode("import scala.collection.mutable")
-
-// @Test def testImport2 = assertPrintedCode("import java.lang.{String=>Str}")
-
-// @Test def testImport3 = assertPrintedCode("import java.lang.{String=>Str, Object=>_, _}")
-
-// @Test def testImport4 = assertPrintedCode("import scala.collection._")
-// }
-
-// trait ClassPrintTests {
-// @Test def testClass = assertPrintedCode("class *")
-
-// @Test def testClassWithBody = assertPrintedCode(sm"""
-// |class X {
-// | def y = "test"
-// |}""")
-
-// @Test def testClassWithPublicParams = assertPrintedCode("class X(val x: Int, val s: String)")
-
-// @Test def testClassWithParams1 = assertPrintedCode("class X(x: Int, s: String)")
-
-// @Test def testClassWithParams2 = assertPrintedCode("class X(@test x: Int, s: String)")
-
-// @Test def testClassWithParams3 = assertPrintedCode("class X(implicit x: Int, s: String)")
-
-// @Test def testClassWithParams4 = assertPrintedCode("class X(implicit @test x: Int, s: String)")
-
-// @Test def testClassWithParams5 = assertPrintedCode("class X(override private[this] val x: Int, s: String) extends Y")
-
-// @Test def testClassWithParams6 = assertPrintedCode("class X(@test1 override private[this] val x: Int, @test2(param1 = 7) s: String) extends Y")
-
-// @Test def testClassWithParams7 = assertPrintedCode("class X protected (val x: Int, val s: String)")
-
-// @Test def testClassWithParams8 = assertPrintedCode("class X(var x: Int)")
-
-// @Test def testClassWithParams9 = assertPrintedCode("class X(var x: Int*)")
-
-// @Test def testClassWithByNameParam = assertPrintedCode("class X(x: => Int)")
-
-// @Test def testClassWithDefault = assertPrintedCode("class X(var x: Int = 5)")
-
-// @Test def testClassWithParams10 = assertPrintedCode("class X(protected[zzz] var x: Int)")
-
-// @Test def testClassWithParams11 = assertPrintedCode("class X(override var x: Int) extends F(x) with E(x)")
-
-// @Test def testClassWithParams12 = assertPrintedCode("class X(val y: Int)()(var z: Double)")
-
-// @Test def testClassWithImplicitParams = assertPrintedCode("class X(var i: Int)(implicit val d: Double, var f: Float)")
-
-// @Test def testClassWithEarly = assertPrintedCode(sm"""
-// |class X(var i: Int) extends {
-// | val a: String = i;
-// | type B
-// |} with Y""")
-
-// @Test def testClassWithThrow1 = assertPrintedCode(sm"""
-// |class Throw1 {
-// | throw new Exception("exception!")
-// |}""")
-
-// @Test def testClassWithThrow2 = assertPrintedCode(sm"""
-// |class Throw2 {
-// | var msg = " ";
-// | val e = new Exception(msg);
-// | throw e
-// |}""")
-
-// /*
-// class Test {
-// val (a, b) = (1, 2)
-// }
-// */
-// @Test def testClassWithAssignmentWithTuple1 = assertPrintedCode(sm"""
-// |class Test {
-// | private[this] val x$$1 = (scala.Tuple2(1, 2): @scala.unchecked) match {
-// | case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2(a, b)
-// | };
-// | val a = x$$1._1;
-// | val b = x$$1._2
-// |}""")
-
-// /*
-// class Test {
-// val (a, b) = (1).->(2)
-// }
-// */
-// @Test def testClassWithAssignmentWithTuple2 = assertPrintedCode(sm"""
-// |class Test {
-// | private[this] val x$$1 = ((1).->(2): @scala.unchecked) match {
-// | case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2(a, b)
-// | };
-// | val a = x$$1._1;
-// | val b = x$$1._2
-// |}""")
-
-// /*
-// class Test {
-// val List(one, three, five) = List(1,3,5)
-// }
-// */
-// @Test def testClassWithPatternMatchInAssignment = assertPrintedCode(sm"""
-// |class Test {
-// | private[this] val x$$1 = (List(1, 3, 5): @scala.unchecked) match {
-// | case List((one @ _), (three @ _), (five @ _)) => scala.Tuple3(one, three, five)
-// | };
-// | val one = x$$1._1;
-// | val three = x$$1._2;
-// | val five = x$$1._3
-// |}""")
-
-// //class A(l: List[_])
-// @Test def testClassWithExistentialParameter1 = assertPrintedCode(sm"""
-// |class Test(l: (List[_$$1] forSome {
-// | type _$$1
-// |}))""")
-
-// @Test def testClassWithExistentialParameter2 = assertPrintedCode(sm"""
-// |class B(l: (List[T] forSome {
-// | type T
-// |}))""")
-
-// @Test def testClassWithCompoundTypeTree = assertPrintedCode(sm"""
-// |{
-// | trait A;
-// | trait B;
-// | abstract class C(val a: A with B) {
-// | def method(x: A with B with C {
-// | val x: Float
-// | }): A with B
-// | };
-// | ()
-// |}""")
-
-// @Test def testClassWithSelectFromTypeTree = assertPrintedCode(sm"""
-// |{
-// | trait A {
-// | type T
-// | };
-// | class B(t: (A)#T);
-// | ()
-// |}""")
-
-// @Test def testImplicitClass = assertPrintedCode("implicit class X(protected[zzz] var x: Int)")
-
-// @Test def testAbstractClass = assertPrintedCode("abstract class X(protected[zzz] var x: Int)")
-
-// @Test def testCaseClassWithParams1 = assertPrintedCode("case class X(x: Int, s: String)")
-
-// @Test def testCaseClassWithParams2 = assertPrintedCode("case class X(protected val x: Int, s: String)")
-
-// @Test def testCaseClassWithParams3 = assertPrintedCode("case class X(implicit x: Int, s: String)")
-
-// @Test def testCaseClassWithParams4 = assertPrintedCode("case class X(override val x: Int, s: String) extends Y")
-
-// @Test def testCaseClassWithBody = assertPrintedCode(sm"""
-// |case class X() {
-// | def y = "test"
-// |}""")
-
-// @Test def testLocalClass = assertPrintedCode(sm"""
-// |def test = {
-// | class X(var a: Int) {
-// | def y = "test"
-// | };
-// | new X(5)
-// |}""")
-
-// @Test def testLocalCaseClass = assertPrintedCode(sm"""
-// |def test = {
-// | case class X(var a: Int) {
-// | def y = "test"
-// | };
-// | new X(5)
-// |}""")
-
-// @Test def testSuperInClass = assertPrintedCode(sm"""
-// |{
-// | trait Root {
-// | def r = "Root"
-// | };
-// | class X extends Root {
-// | def superX = super.r
-// | };
-// | class Y extends X with Root {
-// | class Inner {
-// | val myY = Y.super.r
-// | };
-// | def fromX = super[X].r;
-// | def fromRoot = super[Root].r
-// | };
-// | ()
-// |}""")
-
-// @Test def testThisInClass = assertPrintedCode(sm"""
-// |class Outer {
-// | class Inner {
-// | val outer = Root.this
-// | };
-// | val self = this
-// |}""")
-
-// @Test def testCaseClassWithParamsAndBody = assertPrintedCode(sm"""
-// |case class X(x: Int, s: String) {
-// | def y = "test"
-// |}""")
-
-// @Test def testObject = assertPrintedCode("object *")
-
-// @Test def testObjectWithBody = assertPrintedCode(sm"""
-// |object X {
-// | def y = "test"
-// |}""")
-
-// @Test def testObjectWithEarly1 = assertPrintedCode(sm"""
-// |object X extends {
-// | val early: T = v
-// |} with Bar""")
-
-// @Test def testObjectWithEarly2 = assertPrintedCode(sm"""
-// |object X extends {
-// | val early: T = v;
-// | type EarlyT = String
-// |} with Bar""")
-
-// @Test def testObjectWithSelf = assertPrintedCode(sm"""
-// |object Foo extends Foo { self =>
-// | body
-// |}""")
-
-// @Test def testObjectInh = assertPrintedCode("private[Y] object X extends Bar with Baz")
-
-// @Test def testObjectWithPatternMatch1 = assertPrintedCode(sm"""
-// |object PM1 {
-// | List(1, 2) match {
-// | case (i @ _) => i
-// | }
-// |}""")
-
-// @Test def testObjectWithPatternMatch2 = assertPrintedCode(sm"""
-// |object PM2 {
-// | List(1, 2).map({
-// | case (i @ _) if i.>(5) => i
-// | })
-// |}""")
-
-// //case i: Int => i
-// @Test def testObjectWithPatternMatch3 = assertPrintedCode(sm"""
-// |object PM3 {
-// | List(1, 2).map({
-// | case (i @ ((_): Int)) => i
-// | })
-// |}""")
-
-// //case a @ (i: Int) => i
-// @Test def testObjectWithPatternMatch4 = assertPrintedCode(sm"""
-// |object PM4 {
-// | List(1, 2).map({
-// | case (a @ (i @ ((_): Int))) => i
-// | })
-// |}""")
-
-// @Test def testObjectWithPatternMatch5 = assertPrintedCode(sm"""
-// |object PM5 {
-// | List(1, 2).map({
-// | case _ => 42
-// | })
-// |}""")
-
-// @Test def testObjectWithPatternMatch6 = assertPrintedCode(sm"""
-// |object PM6 {
-// | List(1, 2) match {
-// | case ::((x @ _), (xs @ _)) => x
-// | }
-// |}""")
-
-// @Test def testObjectWithPatternMatch7 = assertPrintedCode(sm"""
-// |object PM7 {
-// | List(1, 2).map({
-// | case (0| 1) => true
-// | case _ => false
-// | })
-// |}""")
-
-// @Test def testObjectWithPatternMatch8 = assertPrintedCode(sm"""
-// |object PM8 {
-// | "abcde".toList match {
-// | case Seq((car @ _), _*) => car
-// | }
-// |}""")
-
-// @Test def testObjectWithPatternMatch9 = assertPrintedCode(sm"""
-// |{
-// | object Extractor {
-// | def unapply(i: Int) = Some(i)
-// | };
-// | object PM9 {
-// | 42 match {
-// | case (a @ Extractor((i @ _))) => i
-// | }
-// | };
-// | ()
-// |}""")
-
-// @Test def testObjectWithPartialFunc = assertPrintedCode(sm"""
-// |object Test {
-// | def partFuncTest[A, B](e: Either[A, B]): scala.Unit = e match {
-// | case Right(_) => ()
-// | }
-// |}""")
-
-// @Test def testObjectWithTry = assertPrintedCode(sm"""
-// |object Test {
-// | import java.io;
-// | var file: PrintStream = null;
-// | try {
-// | val out = new FileOutputStream("myfile.txt");
-// | file = new PrintStream(out)
-// | } catch {
-// | case (ioe @ ((_): IOException)) => println("ioe")
-// | case (e @ ((_): Exception)) => println("e")
-// | } finally println("finally")
-// |}""")
-// }
-
-// trait TraitPrintTests {
-// @Test def testTrait = assertPrintedCode("trait *")
-
-// @Test def testTraitWithBody = assertPrintedCode(sm"""
-// |trait X {
-// | def y = "test"
-// |}""")
-
-// @Test def testTraitWithSelfTypeAndBody = assertPrintedCode(sm"""
-// |trait X { self: Order =>
-// | def y = "test"
-// |}""")
-
-// @Test def testTraitWithSelf1 = assertPrintedCode(sm"""
-// |trait X { self =>
-// | def y = "test"
-// |}""")
-
-// @Test def testTraitWithSelf2 = assertPrintedCode(sm"""
-// |trait X { self: Foo with Bar =>
-// | val x: Int = 1
-// |}""")
-
-// @Test def testTraitTypeParams = assertPrintedCode("trait X[A, B]")
-
-// @Test def testTraitWithBody2 = assertPrintedCode(sm"""
-// |trait X {
-// | def foo: scala.Unit;
-// | val bar: Baz
-// |}""")
-
-// @Test def testTraitWithInh = assertPrintedCode("trait X extends A with B")
-
-// @Test def testTraitWithEarly1 = assertPrintedCode(sm"""
-// |trait X extends {
-// | val x: Int = 1
-// |} with Any""")
-
-// @Test def testTraitWithEarly2 = assertPrintedCode(sm"""
-// |trait X extends {
-// | val x: Int = 0;
-// | type Foo = Bar
-// |} with Y""")
-
-// @Test def testTraitWithEarly3 = assertPrintedCode(sm"""
-// |trait X extends {
-// | val x: Int = 5;
-// | val y: Double = 4.0;
-// | type Foo;
-// | type XString = String
-// |} with Y""")
-
-// @Test def testTraitWithEarly4 = assertPrintedCode(sm"""
-// |trait X extends {
-// | val x: Int = 5;
-// | val y: Double = 4.0;
-// | type Foo;
-// | type XString = String
-// |} with Y {
-// | val z = 7
-// |}""")
-
-// @Test def testTraitWithEarly5 = assertPrintedCode(sm"""
-// |trait X extends {
-// | override protected[this] val x: Int = 5;
-// | val y: Double = 4.0;
-// | private type Foo;
-// | private[ee] type XString = String
-// |} with Y {
-// | val z = 7
-// |}""")
-
-// @Test def testTraitWithSingletonTypeTree = assertPrintedCode(sm"""
-// |trait Test {
-// | def testReturnSingleton(): this.type
-// |}""")
-
-// @Test def testTraitWithThis = assertPrintedCode(sm"""
-// |trait Test { _ : X with Y =>
-// |
-// |}""", q"trait Test { this: X with Y => }")
-
-// @Test def testTraitWithWhile1 = assertPrintedCode(sm"""
-// |trait Test {
-// | while (true.!=(false))
-// | println("testing...")
-// |
-// |}""")
-
-// @Test def testTraitWithWhile2 = assertPrintedCode(sm"""
-// |trait Test {
-// | while (true)
-// | {
-// | println("testing...");
-// | println("testing...")
-// | }
-// |
-// |}""")
-
-// @Test def testTraitWithDoWhile1 = assertPrintedCode(sm"""
-// |trait Test {
-// | do
-// | println("testing...")
-// | while (true)
-// |}""")
-
-// @Test def testTraitWithTypes = assertPrintedCode(sm"""
-// |trait Test {
-// | type A = Int;
-// | type B >: Nothing <: AnyRef;
-// | protected type C >: Nothing;
-// | type D <: AnyRef
-// |}""")
-// }
-
-// trait ValAndDefPrintTests {
-// @Test def testVal1 = assertPrintedCode("val a: Unit = null")
-
-// @Test def testVal2 = assertPrintedCode("val * : Unit = null")
-
-// @Test def testVal3 = assertPrintedCode("val a_ : Unit = null")
-
-// @Test def testDef1 = assertPrintedCode("def a: Unit = null")
-
-// @Test def testDef2 = assertPrintedCode("def * : Unit = null")
-
-// @Test def testDef3 = assertPrintedCode("def a_(x: Int): Unit = null")
-
-// @Test def testDef4 = assertPrintedCode("def a_ : Unit = null")
-
-// @Test def testDef5 = assertPrintedCode("def a_(* : Int): Unit = null")
-
-// @Test def testDef6 = assertPrintedCode("def a_(b_ : Int): Unit = null")
-
-// @Test def testDef7 = assertPrintedCode(sm"""
-// |{
-// | def test1 = ();
-// | def test2() = ()
-// |}""",
-// Block(
-// DefDef(NoMods, newTermName("test1"), Nil, Nil, EmptyTree, Literal(Constant(()))),
-// DefDef(NoMods, newTermName("test2"), Nil, Nil :: Nil, EmptyTree, Literal(Constant(())))
-// )
-// )
-
-// @Test def testDef8 = {
-// val arg = ValDef(Modifiers(Flag.IMPLICIT) , newTermName("a"),
-// AppliedTypeTree(Ident(newTypeName("R")), List(Ident(newTypeName("X")))), EmptyTree)
-
-// //def m[X](implicit a: R[X]) = ()
-// val tree = DefDef(NoMods, newTermName("test"), TypeDef(NoMods, newTypeName("X"), Nil, EmptyTree) :: Nil,
-// List(List(arg)), EmptyTree, Literal(Constant(())))
-
-// assertPrintedCode("def test[X](implicit a: R[X]) = ()", tree)
-// }
-
-// @Test def testDefWithParams1 = assertPrintedCode("def foo(x: Int*) = null")
-
-// @Test def testDefWithParams2 = assertPrintedCode("def foo(x: Int)(y: Int = 1) = null")
-
-// @Test def testDefWithTypeParams1 = assertPrintedCode("def foo[A, B, C](x: A)(y: Int = 1): C = null")
-
-// @Test def testDefWithTypeParams2 = assertPrintedCode("def foo[A, B <: Bar] = null")
-
-// @Test def testDefWithAnn1 = assertPrintedCode("@annot def foo = null")
-
-// @Test def testDefWithAnn2 = assertPrintedCode("@a(x) def foo = null")
-
-// @Test def testDefWithAnn3 = assertPrintedCode("@Foo[A, B] def foo = null")
-
-// @Test def testDefWithAnn4 = assertPrintedCode("@Foo(a)(b)(x, y) def foo = null")
-
-// @Test def testDefWithAnn5 = assertPrintedCode("@Foo[A, B](a)(b) @Bar def foo(x: Int) = null")
-
-// @Test def testDefWithAnn6 = assertPrintedCode("@test1(new test2()) def foo = 42")
-
-// @Test def testDefWithAnn7 = assertPrintedCode("@`t*` def foo = 42")
-
-// @Test def testDefWithAnn8 = assertPrintedCode("@throws(classOf[Exception]) def foo = throw new Exception()")
-
-// @Test def testAnnotated1 = assertPrintedCode("def foo = 42: @test1")
-
-// @Test def testAnnotated2 = assertPrintedCode("""def foo = 42: @test1(42, z = "5")""")
-
-// @Test def testAnnotated3 = assertPrintedCode("def foo = (42: @test1): @test2(new test1())")
-
-// @Test def testAnnotated4 = assertPrintedCode("""def foo = 42: @test1(4, "testing")(4.2)""")
-
-// @Test def testAnnotated5 = assertPrintedCode("""def foo = (42: @test1(4, "testing")(4.2)): @test2(1, "bar")(3.14)""")
-
-// @Test def testAnnotated6 = assertPrintedCode("def foo = ((42: @test1): @test2(new test1())): @test3(1)(2, 3)(4)")
-
-// @Test def testAnnotated7 = assertPrintedCode(sm"""
-// |(x: @unchecked) match {
-// | case ((_): Int) => true
-// | case _ => false
-// |}""")
-
-// @Test def testAnnotated8 = assertPrintedCode(sm"""
-// |((x: @unchecked): @test1(1, "testing")(3.14)) match {
-// | case _ => true
-// |}""")
-// }
-
-// trait PackagePrintTests {
-// @Test def testPackage1 = assertPrintedCode(sm"""
-// |package foo.bar {
-// |
-// |}""")
-
-// @Test def testPackage2 = assertPrintedCode(sm"""
-// |package foo {
-// | class C
-// |
-// | object D
-// |}""")
-
-// //package object foo extends a with b
-// @Test def testPackage3 = assertPrintedCode(sm"""
-// |package foo {
-// | object `package` extends a with b
-// |}""")
-
-// //package object foo { def foo; val x = 1 }
-// @Test def testPackage4 = assertPrintedCode(sm"""
-// |package foo {
-// | object `package` {
-// | def foo: scala.Unit;
-// | val x = 1
-// | }
-// |}""")
-
-// //package object foo extends { val x = 1; type I = Int } with Any
-// @Test def testPackage5 = assertPrintedCode(sm"""
-// |package foo {
-// | object `package` extends {
-// | val x = 1;
-// | type I = Int
-// | } with Any
-// |}""")
-// }
-
-// trait QuasiTreesPrintTests {
-// @Test def testQuasiIdent = assertPrintedCode("*", q"*")
-
-// @Test def testQuasiVal = assertPrintedCode("val * : Unit = null", q"val * : Unit = null")
-
-// @Test def testQuasiDef = assertPrintedCode("def * : Unit = null", q"def * : Unit = null")
-
-// @Test def testQuasiTrait = assertPrintedCode("trait *", q"trait *")
-
-// @Test def testQuasiClass = assertPrintedCode("class *", q"class *")
-
-// @Test def testQuasiClassWithPublicParams = assertPrintedCode( "class X(val x: Int, val s: String)", q"class X(val x: Int, val s:String)" )
-
-// @Test def testQuasiClassWithParams = assertPrintedCode("class X(x: Int, s: String)", q"class X(x: Int, s:String)")
-
-// @Test def testQuasiObject = assertPrintedCode("object *", q"object *")
-
-// @Test def testQuasiObjectWithBody = assertPrintedCode(sm"""
-// |object X {
-// | def y = "test"
-// |}""", q"""object X{ def y = "test" }""")
-
-// @Test def testQuasiClassWithBody = assertPrintedCode(sm"""
-// |class X {
-// | def y = "test"
-// |}""", q"""class X{ def y = "test" }""")
-
-// @Test def testQuasiTraitWithBody = assertPrintedCode(sm"""
-// |trait X {
-// | def y = "test"
-// |}""", q"""trait X{ def y = "test" }""")
-
-// @Test def testQuasiTraitWithSelfTypeAndBody = assertPrintedCode(sm"""
-// |trait X { self: Order =>
-// | def y = "test"
-// |}""", q"""trait X{ self: Order => def y = "test" }""")
-
-// @Test def testQuasiTraitWithSelf = assertPrintedCode(sm"""
-// |trait X { self =>
-// | def y = "test"
-// |}""", q"""trait X{ self => def y = "test" }""")
-
-// @Test def testQuasiCaseClassWithBody = assertPrintedCode(sm"""
-// |case class X() {
-// | def y = "test"
-// |}""", q"""case class X() { def y = "test" }""")
-
-// @Test def testQuasiCaseClassWithParamsAndBody = assertPrintedCode(sm"""
-// |case class X(x: Int, s: String) {
-// | def y = "test"
-// |}""", q"""case class X(x: Int, s: String){ def y = "test" }""")
-// } \ No newline at end of file
+ implicit class StrContextStripMarginOps(val stringContext: StringContext) extends util.StripMarginInterpolator
+}
+
+import PrinterHelper._
+
+trait BasePrintTests {
+ @Test def testIdent = assertTreeCode(Ident("*"))("*")
+
+ @Test def testConstant1 = assertTreeCode(Literal(Constant("*")))("\"*\"")
+
+ @Test def testConstant2 = assertTreeCode(Literal(Constant(42)))("42")
+
+ @Test def testConstantFloat = assertTreeCode(Literal(Constant(42f)))("42.0F")
+
+ @Test def testConstantDouble = assertTreeCode(Literal(Constant(42d)))("42.0")
+
+ @Test def testConstantLong = assertTreeCode(Literal(Constant(42l)))("42L")
+
+ @Test def testOpExpr = assertPrintedCode("(5).+(4)", checkTypedTree = false)
+
+ @Test def testName1 = assertPrintedCode("class test")
+
+ @Test def testName2 = assertPrintedCode("class *")
+
+ @Test def testName4 = assertPrintedCode("class `a*`")
+
+ @Test def testName5 = assertPrintedCode("val :::: = 1")
+
+ @Test def testName6 = assertPrintedCode("val `::::t` = 1")
+
+ @Test def testName7 = assertPrintedCode("""class \/""")
+
+ @Test def testName8 = assertPrintedCode("""class \\\\""")
+
+ @Test def testName9 = assertPrintedCode("""class test_\/""")
+
+ @Test def testName10 = assertPrintedCode("""class `*_*`""")
+
+ @Test def testName11 = assertPrintedCode("""class `a_*`""")
+
+ @Test def testName12 = assertPrintedCode("""class `*_a`""")
+
+ @Test def testName13 = assertPrintedCode("""class a_a""")
+
+ @Test def testName14 = assertPrintedCode("val x$11 = 5")
+
+ @Test def testName15 = assertPrintedCode("class `[]`")
+
+ @Test def testName16 = assertPrintedCode("class `()`")
+
+ @Test def testName17 = assertPrintedCode("class `{}`")
+
+ @Test def testName18 = assertPrintedCode("class <>")
+
+ @Test def testName19 = assertPrintedCode("""class `class`""")
+
+ @Test def testName20 = assertPrintedCode("""class `test name`""")
+
+ @Test def testIfExpr1 = assertResultCode(code = sm"""
+ |val a = 1
+ |if (a > 1)
+ | a: Int
+ |else
+ | (a.toString): String
+ """)(
+ parsedCode = sm"""
+ |val a = 1;
+ |if (a.>(1))
+ | ((a): Int)
+ |else
+ | ((a.toString): String)""",
+ typedCode=sm"""
+ |val a = 1;
+ |if (PrintersContext.this.a.>(1))
+ | ((PrintersContext.this.a): scala.Int)
+ |else
+ | ((PrintersContext.this.a.toString()): scala.Predef.String)
+ """, wrap = true)
+
+ @Test def testIfExpr2 = assertPrintedCode(sm"""
+ |class A {
+ | (if (true)
+ | {
+ | false;
+ | ()
+ | }
+ |else
+ | {
+ | true;
+ | ()
+ | }).toString()
+ |}""")
+
+ @Test def testIfExpr3 = assertPrintedCode(sm"""
+ |class A {
+ | (if (true)
+ | {
+ | false;
+ | ()
+ | }
+ |else
+ | {
+ | true;
+ | ()
+ | }).toString().hashCode()
+ |}""")
+
+ //val x = true && true && false.!
+ @Test def testBooleanExpr1 = assertPrintedCode("val x = true.&&(true).&&(false.`unary_!`)", checkTypedTree = false)
+
+ //val x = true && !(true && false)
+ @Test def testBooleanExpr2 = assertPrintedCode("val x = true.&&(true.&&(false).`unary_!`)", checkTypedTree = false)
+
+ @Test def testNewExpr1 = assertResultCode(
+ code = sm"""
+ |class foo
+ |new foo()
+ |""")(
+ parsedCode = sm"""
+ |class foo;
+ |new foo()""",
+ typedCode = sm"""
+ |class foo;
+ |new PrintersContext.this.foo()
+ |""",
+ wrap = true)
+
+ @Test def testNewExpr2 = assertResultCode(
+ code = sm"""
+ |class foo
+ |new foo { "test" }
+ |""")(
+ parsedCode = sm"""
+ |class foo;
+ |{
+ | final class $$anon extends foo {
+ | "test"
+ | };
+ | new $$anon()
+ |}""",
+ typedCode = sm"""
+ |class foo;
+ |{
+ | final class $$anon extends PrintersContext.this.foo {
+ | "test"
+ | };
+ | new $$anon()
+ |}""",
+ wrap = true)
+
+ @Test def testNewExpr3 = assertPrintedCode(sm"""
+ |{
+ | class foo[t];
+ | new foo[scala.Int]()
+ |}""")
+
+ @Test def testNewExpr4 = assertPrintedCode(sm"""
+ |{
+ | class foo(x: scala.Int);
+ | val x = 5;
+ | new foo(x)
+ |}""")
+
+ @Test def testNewExpr5 = assertPrintedCode(sm"""
+ |{
+ | class foo[t](x: scala.Int);
+ | val x = 5;
+ | new foo[scala.Predef.String](x)
+ |}""")
+
+ //new foo[t](x) { () }
+ @Test def testNewExpr6 = assertResultCode(
+ code = sm"""
+ |class foo[t](x: Int)
+ |new foo[String](3) { () }
+ |""")(
+ parsedCode = sm"""
+ |{
+ | class foo[t](x: Int);
+ | {
+ | final class $$anon extends foo[String](3) {
+ | ()
+ | };
+ | new $$anon()
+ | }
+ |}""",
+ typedCode = sm"""
+ |{
+ | class foo[t](x: scala.Int);
+ | {
+ | final class $$anon extends foo[scala.Predef.String](3) {
+ | ()
+ | };
+ | new $$anon()
+ | }
+ |}""")
+
+ //new foo with bar
+ @Test def testNewExpr7 = assertPrintedCode(sm"""
+ |{
+ | trait foo;
+ | trait bar;
+ | {
+ | final class $$anon extends foo with bar;
+ | new $$anon()
+ | }
+ |}""")
+
+ //new { anonymous }
+ @Test def testNewExpr8 = assertPrintedCode(sm"""
+ |{
+ | final class $$anon {
+ | 5
+ | };
+ | new $$anon()
+ |}""")
+
+ //new { val early = 1 } with Parent[Int] { body }
+ @Test def testNewExpr9 = assertPrintedCode(sm"""
+ |{
+ | class Parent[t];
+ | {
+ | final class $$anon extends {
+ | val early = 1
+ | } with Parent[scala.Int] {
+ | "testNewExpr"
+ | };
+ | new $$anon()
+ | }
+ |}""")
+
+ //new Foo { self => }
+ @Test def testNewExpr10 = assertPrintedCode(sm"""
+ |{
+ | class Foo;
+ | {
+ | final class $$anon extends Foo { self =>
+ |
+ | };
+ | new $$anon()
+ | }
+ |}""")
+
+ @Test def testReturn = assertPrintedCode("def test: scala.Int = return 42")
+
+ @Test def testFunc1 = assertResultCode(
+ code = "List(1, 2, 3).map((i: Int) => i - 1)")(
+ parsedCode = "List(1, 2, 3).map(((i: Int) => i.-(1)))",
+ typedCode = sm"scala.collection.immutable.List.apply(1, 2, 3).map(((i: scala.Int) => i.-(1)))(scala.collection.immutable.List.canBuildFrom)")
+
+ @Test def testFunc2 = assertResultCode(
+ code = "val sum: Seq[Int] => Int = _ reduceLeft (_+_)")(
+ parsedCode = "val sum: _root_.scala.Function1[Seq[Int], Int] = ((x$1) => x$1.reduceLeft(((x$2, x$3) => x$2.+(x$3))))",
+ typedCode = "val sum: _root_.scala.Function1[scala.`package`.Seq[scala.Int], scala.Int] = ((x$1) => x$1.reduceLeft(((x$2, x$3) => x$2.+(x$3))))")
+
+ @Test def testFunc3 = assertResultCode(
+ code = "List(1, 2, 3) map (_ - 1)")(
+ parsedCode = "List(1, 2, 3).map(((x$1) => x$1.-(1))) ",
+ typedCode = "scala.collection.immutable.List.apply(1, 2, 3).map(((x$1) => x$1.-(1)))(scala.collection.immutable.List.canBuildFrom)")
+
+ @Test def testFunc4 = assertResultCode(
+ code = "val x: String => Int = ((str: String) => 1)")(
+ parsedCode = "val x: _root_.scala.Function1[String, Int] = ((str: String) => 1)",
+ typedCode = " val x: _root_.scala.Function1[_root_.scala.Predef.String, _root_.scala.Int] = ((str: _root_.scala.Predef.String) => 1)", printRoot = true)
+
+ @Test def testAssign1 = assertPrintedCode("(f.v = 5).toString", checkTypedTree = false)
+
+ @Test def testAssign2 = assertPrintedCode("(f.v = 5)(2)", checkTypedTree = false)
+
+ @Test def testImport1 = assertPrintedCode("import scala.collection.mutable")
+
+ @Test def testImport2 = assertPrintedCode("import java.lang.{String=>Str}")
+
+ @Test def testImport3 = assertPrintedCode("import java.lang.{String=>Str, Object=>_, _}")
+
+ @Test def testImport4 = assertPrintedCode("import scala.collection._")
+}
+
+trait ClassPrintTests {
+ @Test def testClass = assertPrintedCode("class *")
+
+ @Test def testClassWithBody = assertPrintedCode(sm"""
+ |class X {
+ | def y = "test"
+ |}""")
+
+ @Test def testClassWithPublicParams = assertPrintedCode("class X(val x: scala.Int, val s: scala.Predef.String)")
+
+ @Test def testClassWithParams1 = assertPrintedCode("class X(x: scala.Int, s: scala.Predef.String)")
+
+ @Test def testClassWithParams2 = assertPrintedCode("class X(@test x: Int, s: String)", checkTypedTree = false)
+
+ @Test def testClassWithParams3 = assertPrintedCode("class X(implicit x: Int, s: String)", checkTypedTree = false)
+
+ @Test def testClassWithParams4 = assertPrintedCode("class X(implicit @unchecked x: Int, s: String)", checkTypedTree = false)
+
+ @Test def testClassWithParams5 = assertPrintedCode(sm"""
+ |{
+ | class Y {
+ | val x = 5
+ | };
+ | class X(override private[this] val x: scala.Int, s: scala.Predef.String) extends Y;
+ | ()
+ |}""")
+
+ @Test def testClassWithParams6 = assertPrintedCode("class X(@test1 override private[this] val x: Int, @test2(param1 = 7) s: String) extends Y", checkTypedTree = false)
+
+ @Test def testClassWithParams7 = assertPrintedCode("class X protected (val x: scala.Int, val s: scala.Predef.String)")
+
+ @Test def testClassWithParams8 = assertPrintedCode("class X(var x: scala.Int)")
+
+ @Test def testClassWithParams9 = assertPrintedCode("def test(x: scala.Int*) = 5")
+
+ @Test def testClassWithByNameParam = assertPrintedCode("class X(x: => scala.Int)")
+
+ @Test def testClassWithDefault = assertPrintedCode(sm"""
+ |{
+ | class X(var x: scala.Int = 5);
+ | ()
+ |}""")
+
+ @Test def testClassWithParams10 = assertPrintedCode("class X(protected[zzz] var x: Int)", checkTypedTree = false)
+
+ @Test def testClassWithParams11 = assertPrintedCode(sm"""
+ |{
+ | class F(x: scala.Int);
+ | trait E {
+ | var x: scala.Int
+ | };
+ | class X(override var x: scala.Int = 5) extends F(x) with E;
+ | ()
+ |}""")
+
+ @Test def testClassWithParams12 = assertPrintedCode("class X(val y: scala.Int)()(var z: scala.Double)")
+
+ @Test def testClassWithImplicitParams = assertPrintedCode("class X(var i: scala.Int)(implicit val d: scala.Double, var f: scala.Float)")
+
+ @Test def testClassWithEarly = assertPrintedCode(sm"""
+ |class X(var i: scala.Int) extends {
+ | val a = i;
+ | type B
+ |} with scala.Serializable""")
+
+ @Test def testClassWithThrow1 = assertPrintedCode(sm"""
+ |class Throw1 {
+ | throw new scala.`package`.Exception("exception!")
+ |}""")
+
+ @Test def testClassWithThrow2 = assertPrintedCode(sm"""
+ |class Throw2 {
+ | var msg = " ";
+ | val e = new scala.`package`.Exception(Throw2.this.msg);
+ | throw Throw2.this.e
+ |}""")
+
+ /*
+ class Test {
+ val (a, b) = (1, 2)
+ }
+ */
+ @Test def testClassWithAssignmentWithTuple1 = assertPrintedCode(sm"""
+ |class Test {
+ | private[this] val x$$1 = (scala.Tuple2.apply(1, 2): @scala.unchecked) match {
+ | case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2.apply(a, b)
+ | };
+ | val a = Test.this.x$$1._1;
+ | val b = Test.this.x$$1._2
+ |}""")
+
+ @Test def testClassWithAssignmentWithTuple2 = assertResultCode(
+ code = sm"""
+ |class Test {
+ | val (a, b) = (1).->(2)
+ |}""")(
+ parsedCode = sm"""
+ |class Test {
+ | private[this] val x$$1 = ((1).->(2): @scala.unchecked) match {
+ | case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2(a, b)
+ | };
+ | val a = x$$1._1;
+ | val b = x$$1._2
+ |}""",
+ typedCode = sm"""
+ |class Test {
+ | private[this] val x$$1 = (scala.Predef.ArrowAssoc(1).->(2): @scala.unchecked) match {
+ | case scala.Tuple2((a @ _), (b @ _)) => scala.Tuple2.apply(a, b)
+ | };
+ | val a = Test.this.x$$1._1;
+ | val b = Test.this.x$$1._2
+ |}""")
+
+ /*
+ class Test {
+ val List(one, three, five) = List(1,3,5)
+ }
+ */
+ @Test def testClassWithPatternMatchInAssignment = assertPrintedCode(sm"""
+ |class Test {
+ | private[this] val x$$1 = (scala.collection.immutable.List.apply(1, 3, 5): @scala.unchecked) match {
+ | case scala.collection.immutable.List((one @ _), (three @ _), (five @ _)) => scala.Tuple3.apply(one, three, five)
+ | };
+ | val one = Test.this.x$$1._1;
+ | val three = Test.this.x$$1._2;
+ | val five = Test.this.x$$1._3
+ |}""")
+
+ //class A(l: List[_])
+ @Test def testClassWithExistentialParameter1 = assertPrintedCode(sm"""
+ |class Test(l: (scala.`package`.List[_$$1] forSome {
+ | type _$$1
+ |}))""")
+
+ @Test def testClassWithExistentialParameter2 = assertPrintedCode(sm"""
+ |class B(l: (scala.`package`.List[T] forSome {
+ | type T
+ |}))""")
+
+ @Test def testClassWithCompoundTypeTree = assertPrintedCode(sm"""
+ |{
+ | trait A;
+ | trait B;
+ | abstract class C(val a: A with B) {
+ | def method(x: A with B with C {
+ | val x: scala.Float
+ | }): A with B
+ | };
+ | ()
+ |}""")
+
+ @Test def testClassWithSelectFromTypeTree = assertPrintedCode(sm"""
+ |{
+ | trait A {
+ | type T
+ | };
+ | class B(t: (A)#T);
+ | ()
+ |}""")
+
+ @Test def testImplicitClass = assertPrintedCode(sm"""
+ |{
+ | implicit class X(protected[this] var x: scala.Int);
+ | ()
+ |}""",
+ checkTypedTree = true)
+
+ @Test def testAbstractClass = assertPrintedCode("abstract class X(protected[this] var x: scala.Int)")
+
+ @Test def testCaseClassWithParams1 = assertPrintedCode(sm"""
+ |{
+ | case class X(x: scala.Int, s: scala.Predef.String);
+ | ()
+ |}""")
+
+ @Test def testCaseClassWithParams2 = assertPrintedCode(sm"""
+ |{
+ | case class X(protected val x: scala.Int, s: scala.Predef.String);
+ | ()
+ |}""")
+
+ @Test def testCaseClassWithParams3 = assertPrintedCode(sm"""
+ |{
+ | case class X(implicit x: scala.Int, s: scala.Predef.String);
+ | ()
+ |}""")
+
+ @Test def testCaseClassWithParams4 = assertPrintedCode(sm"""
+ |{
+ | trait V {
+ | val x: scala.Int
+ | };
+ | case class X(override val x: scala.Int, s: scala.Predef.String) extends scala.Cloneable;
+ | ()
+ |}""")
+
+ @Test def testCaseClassWithBody = assertPrintedCode(sm"""
+ |{
+ | case class X() {
+ | def y = "test"
+ | };
+ | ()
+ |}""")
+
+ @Test def testLocalClass = assertPrintedCode(sm"""
+ |def test = {
+ | class X(var a: scala.Int) {
+ | def y = "test"
+ | };
+ | new X(5)
+ |}""")
+
+ @Test def testLocalCaseClass = assertPrintedCode(sm"""
+ |def test = {
+ | case class X(var a: scala.Int) {
+ | def y = "test"
+ | };
+ | new X(5)
+ |}""")
+
+ @Test def testSuperInClass = assertPrintedCode(sm"""
+ |{
+ | trait Root {
+ | def r = "Root"
+ | };
+ | class X extends Root {
+ | def superX = super.r
+ | };
+ | class Y extends X with Root {
+ | class Inner {
+ | val myY = Y.super.r
+ | };
+ | def fromX = super[X].r;
+ | def fromRoot = super[Root].r
+ | };
+ | ()
+ |}""")
+
+ @Test def testThisInClass = assertPrintedCode(sm"""
+ |class Outer {
+ | class Inner {
+ | val outer = Outer.this
+ | };
+ | val self = this
+ |}""")
+
+ @Test def testCaseClassWithParamsAndBody = assertPrintedCode(sm"""
+ |{
+ | case class X(var x: scala.Int, var s: scala.Predef.String) {
+ | def y = "test"
+ | };
+ | ()
+ |}""")
+
+ @Test def testObject = assertPrintedCode("object *")
+
+ @Test def testObjectWithBody = assertPrintedCode(sm"""
+ |object X {
+ | def y = "test"
+ |}""")
+
+ @Test def testObjectWithEarly1 = assertPrintedCode(sm"""
+ |object X extends {
+ | val early: scala.Int = 42
+ |} with scala.Serializable""")
+
+ @Test def testObjectWithEarly2 = assertPrintedCode(sm"""
+ |object X extends {
+ | val early: scala.Int = 42;
+ | type EarlyT = scala.Predef.String
+ |} with scala.Serializable""")
+
+ @Test def testObjectWithSelf = assertPrintedCode(sm"""
+ |object Foo extends scala.Serializable { self =>
+ | 42
+ |}""")
+
+ @Test def testObjectInh = assertPrintedCode(sm"""
+ |trait Y {
+ | private[Y] object X extends scala.Serializable with scala.Cloneable
+ |}""")
+
+ @Test def testObjectWithPatternMatch1 = assertPrintedCode(sm"""
+ |object PM1 {
+ | scala.collection.immutable.List.apply(1, 2) match {
+ | case (i @ _) => i
+ | }
+ |}""")
+
+ @Test def testObjectWithPatternMatch2 = assertResultCode(
+ code = sm"""
+ |object PM2 {
+ | List(1, 2).map {
+ | case i if i > 5 => i
+ | }
+ |}""")(
+ parsedCode = sm"""
+ |object PM2 {
+ | List(1, 2).map({
+ | case (i @ _) if i.>(5) => i
+ | })
+ |}""")
+ /*
+ typedCode = sm"""
+ |object PM2 {
+ | scala.collection.immutable.List.apply(1, 2).map(((x0$$1) => x0$$1 match {
+ | case (i @ _) if i.>(5) => i
+ | }))(scala.collection.immutable.List.canBuildFrom)
+ |}""")
+ *
+ */
+
+ @Test def testObjectWithPatternMatch3 = assertResultCode(
+ code = sm"""
+ |object PM3 {
+ | List(1, 2).map {
+ | case i: Int => i
+ | }
+ |}""")(
+ parsedCode = sm"""
+ |object PM3 {
+ | List(1, 2).map({
+ | case (i @ ((_): Int)) => i
+ | })
+ |}""")
+ /*
+ typedCode = sm"""
+ |object PM3 {
+ | scala.collection.immutable.List.apply(1, 2).map(((x0$$2) => x0$$2 match {
+ | case (i @ ((_): scala.Int)) => i
+ | }))(scala.collection.immutable.List.canBuildFrom)
+ |}""")
+ *
+ */
+
+ @Test def testObjectWithPatternMatch4 = assertResultCode(
+ code = sm"""
+ |object PM4 {
+ | List(1, 2).map {
+ | case _ => 42
+ | }
+ |}""")(
+ parsedCode = sm"""
+ |object PM4 {
+ | List(1, 2).map({
+ | case _ => 42
+ | })
+ |}""")
+ /*
+ typedCode = sm"""
+ |object PM4 {
+ | scala.collection.immutable.List.apply(1, 2).map(((x0$$3) => x0$$3 match {
+ | case _ => 42
+ | }))(scala.collection.immutable.List.canBuildFrom)
+ |}""")
+ *
+ */
+
+ @Test def testObjectWithPatternMatch5 = assertResultCode(
+ code = sm"""
+ |object PM5 {
+ | List(1, 2) match {
+ | case x :: xs => x
+ | }
+ |}""")(
+ parsedCode = sm"""
+ |object PM5 {
+ | List(1, 2) match {
+ | case ::((x @ _), (xs @ _)) => x
+ | }
+ |}""",
+ typedCode = sm"""
+ |object PM5 {
+ | scala.collection.immutable.List.apply(1, 2) match {
+ | case scala.`package`.::((x @ _), (xs @ _)) => x
+ | }
+ |}""")
+
+ @Test def testObjectWithPatternMatch6 = assertResultCode(
+ code = sm"""
+ |object PM6 {
+ | List(1, 2).map {
+ | case (0 | 1) => true
+ | case _ => false
+ | }
+ |}""")(
+ parsedCode = sm"""
+ |object PM6 {
+ | List(1, 2).map({
+ | case (0| 1) => true
+ | case _ => false
+ | })
+ |}""")
+ /*
+ typedCode = sm"""
+ |object PM6 {
+ | scala.collection.immutable.List.apply(1, 2).map(((x0$$4) => x0$$4 match {
+ | case (0| 1) => true
+ | case _ => false
+ | }))(scala.collection.immutable.List.canBuildFrom)
+ |}"""
+ *
+ */
+
+ @Test def testObjectWithPatternMatch7 = assertPrintedCode(sm"""
+ |object PM7 {
+ | scala.Predef.augmentString("abcde").toList match {
+ | case scala.collection.Seq((car @ _), _*) => car
+ | }
+ |}""")
+
+ @Test def testObjectWithPatternMatch8 = assertPrintedCode(sm"""
+ |{
+ | object Extractor {
+ | def unapply(i: scala.Int) = scala.Some.apply(i)
+ | };
+ | object PM9 {
+ | 42 match {
+ | case (a @ Extractor((i @ _))) => i
+ | }
+ | };
+ | ()
+ |}""")
+
+ @Test def testObjectWithPartialFunc = assertPrintedCode(sm"""
+ |object Test {
+ | def partFuncTest[A, B](e: scala.`package`.Either[A, B]): scala.Unit = e match {
+ | case scala.`package`.Right(_) => ()
+ | }
+ |}""")
+
+ @Test def testObjectWithTry = assertResultCode(
+ code = sm"""
+ |object Test {
+ | import java.io._;
+ | var file: PrintStream = null;
+ | try {
+ | val out = new FileOutputStream("myfile.txt");
+ | file = new PrintStream(out)
+ | } catch {
+ | case ioe: IOException => println("ioe")
+ | case e: Exception => println("e")
+ | } finally println("finally")
+ |}""")(
+ parsedCode = sm"""
+ |object Test {
+ | import java.io._;
+ | var file: PrintStream = null;
+ | try {
+ | val out = new FileOutputStream("myfile.txt");
+ | file = new PrintStream(out)
+ | } catch {
+ | case (ioe @ ((_): IOException)) => println("ioe")
+ | case (e @ ((_): Exception)) => println("e")
+ | } finally println("finally")
+ |}""",
+ typedCode = sm"""
+ |object Test {
+ | import java.io._;
+ | var file: java.io.PrintStream = null;
+ | try {
+ | val out = new java.io.FileOutputStream("myfile.txt");
+ | Test.this.`file_=`(new java.io.PrintStream(out))
+ | } catch {
+ | case (ioe @ ((_): java.io.IOException)) => scala.Predef.println("ioe")
+ | case (e @ ((_): scala.`package`.Exception)) => scala.Predef.println("e")
+ | } finally scala.Predef.println("finally")
+ |}""")
+}
+
+trait TraitPrintTests {
+ @Test def testTrait = assertPrintedCode("trait *")
+
+ @Test def testTraitWithBody = assertPrintedCode(sm"""
+ |trait X {
+ | def y = "test"
+ |}""")
+
+ @Test def testTraitWithSelfTypeAndBody = assertPrintedCode(sm"""
+ |trait X { self: scala.Cloneable =>
+ | def y = "test"
+ |}""")
+
+ @Test def testTraitWithSelf1 = assertPrintedCode(sm"""
+ |trait X { self =>
+ | def y = "test"
+ |}""")
+
+ @Test def testTraitWithSelf2 = assertPrintedCode(sm"""
+ |trait X { self: scala.Cloneable with scala.Serializable =>
+ | val x: scala.Int = 1
+ |}""")
+
+ @Test def testTraitTypeParams = assertPrintedCode("trait X[A, B]")
+
+ @Test def testTraitWithBody2 = assertPrintedCode(sm"""
+ |trait X {
+ | def foo: scala.Unit;
+ | val bar: scala.Predef.String
+ |}""")
+
+ @Test def testTraitWithInh = assertPrintedCode("trait X extends scala.Cloneable with scala.Serializable")
+
+ @Test def testTraitWithEarly1 = assertPrintedCode(sm"""
+ |trait X extends {
+ | val x: Int = 1
+ |} with AnyRef""", checkTypedTree = false)
+
+ @Test def testTraitWithEarly2 = assertPrintedCode(sm"""
+ |trait X extends {
+ | val x: scala.Int = 0;
+ | type Foo = scala.Unit
+ |} with scala.Cloneable""")
+
+ @Test def testTraitWithEarly3 = assertPrintedCode(sm"""
+ |trait X extends {
+ | val x: scala.Int = 5;
+ | val y: scala.Double = 4.0;
+ | type Foo;
+ | type XString = scala.Predef.String
+ |} with scala.Serializable""")
+
+ @Test def testTraitWithEarly4 = assertPrintedCode(sm"""
+ |trait X extends {
+ | val x: scala.Int = 5;
+ | val y: scala.Double = 4.0;
+ | type Foo;
+ | type XString = scala.Predef.String
+ |} with scala.Serializable {
+ | val z = 7
+ |}""")
+
+ @Test def testTraitWithSingletonTypeTree = assertPrintedCode(sm"""
+ |trait Test {
+ | def testReturnSingleton(): Test.this.type
+ |}""")
+
+ @Test def testTraitWithThis = assertTreeCode(q"trait Test { this: X with Y => }")(sm"""
+ |trait Test { _ : X with Y =>
+ |
+ |}""")
+
+ @Test def testTraitWithWhile1 = assertPrintedCode(sm"""
+ |trait Test {
+ | while (false)
+ | scala.Predef.println("testing...")
+ |
+ |}""")
+
+ @Test def testTraitWithWhile2 = assertPrintedCode(sm"""
+ |trait Test {
+ | while (true)
+ | {
+ | scala.Predef.println("testing...");
+ | scala.Predef.println("testing...")
+ | }
+ |
+ |}""")
+
+ @Test def testTraitWithDoWhile1 = assertPrintedCode(sm"""
+ |trait Test {
+ | do
+ | scala.Predef.println("testing...")
+ | while (true)
+ |}""")
+
+ @Test def testTraitWithTypes = assertResultCode(
+ code = sm"""
+ |trait Test {
+ | type A = Int;
+ | type B >: Nothing <: AnyRef;
+ | protected type C >: Nothing;
+ | type D <: AnyRef
+ |}""")(
+ parsedCode = sm"""
+ |trait Test {
+ | type A = Int;
+ | type B >: Nothing <: AnyRef;
+ | protected type C >: Nothing;
+ | type D <: AnyRef
+ |}""",
+ typedCode = sm"""
+ |trait Test {
+ | type A = scala.Int;
+ | type B <: scala.AnyRef;
+ | protected type C;
+ | type D <: scala.AnyRef
+ |}""")
+}
+
+trait ValAndDefPrintTests {
+ @Test def testVal1 = assertPrintedCode("val a: scala.Unit = ()")
+
+ @Test def testVal2 = assertPrintedCode("val * : scala.Unit = ()")
+
+ @Test def testVal3 = assertPrintedCode("val a_ : scala.Unit = ()")
+
+ @Test def testDef1 = assertPrintedCode("def a = ()")
+
+ @Test def testDef2 = assertPrintedCode("def * : scala.Unit = ()")
+
+ @Test def testDef3 = assertPrintedCode("def a_(x: scala.Int): scala.Unit = ()")
+
+ @Test def testDef4 = assertPrintedCode("def a_ : scala.Unit = ()")
+
+ @Test def testDef5 = assertPrintedCode("def a_(* : scala.Int): scala.Unit = ()")
+
+ @Test def testDef6 = assertPrintedCode("def a_(b_ : scala.Int) = ()")
+
+ @Test def testDef7 = assertTreeCode{
+ Block(
+ DefDef(NoMods, newTermName("test1"), Nil, Nil, EmptyTree, Literal(Constant(()))),
+ DefDef(NoMods, newTermName("test2"), Nil, Nil :: Nil, EmptyTree, Literal(Constant(())))
+ )
+ }(sm"""
+ |{
+ | def test1 = ();
+ | def test2() = ()
+ |}""")
+
+ @Test def testDef8 = {
+ val arg = ValDef(Modifiers(Flag.IMPLICIT) , newTermName("a"),
+ AppliedTypeTree(Ident(newTypeName("R")), List(Ident(newTypeName("X")))), EmptyTree)
+
+ //def m[X](implicit a: R[X]) = ()
+ val tree = DefDef(NoMods, newTermName("test"), TypeDef(NoMods, newTypeName("X"), Nil, EmptyTree) :: Nil,
+ List(List(arg)), EmptyTree, Literal(Constant(())))
+
+ assertTreeCode(tree)("def test[X](implicit a: R[X]) = ()")
+ }
+
+ @Test def testDef9 = assertPrintedCode("def a(x: scala.Int)(implicit z: scala.Double, y: scala.Float): scala.Unit = ()")
+
+ @Test def testDefWithLazyVal1 = assertResultCode(
+ code = "def a = { lazy val test: Int = 42 }")(
+ parsedCode = sm"""
+ |def a = {
+ | lazy val test: Int = 42;
+ | ()
+ |}
+ """,
+ typedCode = sm"""
+ |def a = {
+ | lazy val test: scala.Int = 42;
+ | ()
+ |}""")
+
+ @Test def testDefWithLazyVal2 = assertPrintedCode(sm"""
+ |def a = {
+ | lazy val test = {
+ | scala.Predef.println();
+ | scala.Predef.println()
+ | };
+ | ()
+ |}""")
+
+ @Test def testDefWithParams1 = assertPrintedCode("def foo(x: scala.Int*) = ()")
+
+ @Test def testDefWithParams2 = assertPrintedCode(sm"""
+ |{
+ | def foo(x: scala.Int)(y: scala.Int = 1) = ();
+ | ()
+ |}""")
+
+ @Test def testDefWithTypeParams1 = assertPrintedCode(sm"""
+ |{
+ | def foo[A, B, C](x: A)(y: scala.Int = 1): C = ().asInstanceOf[C];
+ | ()
+ |}""")
+
+ @Test def testDefWithTypeParams2 = assertPrintedCode("def foo[A, B <: scala.AnyVal] = ()")
+
+ @Test def testDefWithAnn1 = assertPrintedCode("@annot def foo = null", checkTypedTree = false)
+
+ @Test def testDefWithAnn2 = assertPrintedCode("@a(x) def foo = null", checkTypedTree = false)
+
+ @Test def testDefWithAnn3 = assertPrintedCode("@Foo[A, B] def foo = null", checkTypedTree = false)
+
+ @Test def testDefWithAnn4 = assertPrintedCode("@Foo(a)(b)(x, y) def foo = null", checkTypedTree = false)
+
+ @Test def testDefWithAnn5 = assertPrintedCode("@Foo[A, B](a)(b) @Bar def foo(x: Int) = null", checkTypedTree = false)
+
+ @Test def testDefWithAnn6 = assertPrintedCode("@test1(new test2()) def foo = 42", checkTypedTree = false)
+
+ @Test def testDefWithAnn7 = assertPrintedCode("@`t*` def foo = 42", checkTypedTree = false)
+
+ @Test def testDefWithAnn8 = assertPrintedCode("@throws(classOf[Exception]) def foo = throw new Exception()", checkTypedTree = false)
+
+ @Test def testAnnotated1 = assertResultCode(
+ code = "def foo = 42: @baz")(
+ parsedCode = "def foo = 42: @baz",
+ typedCode = "def foo = (42: @baz)",
+ wrap = true)
+
+ @Test def testAnnotated2 = assertResultCode(
+ code = "def foo = 42: @foo2[A1, B1](4)(2)")(
+ parsedCode = "def foo = 42: @foo2[A1, B1](4)(2)",
+ typedCode = "def foo = (42: @foo2[A1, B1](4)(2))",
+ wrap = true)
+
+ @Test def testAnnotated3 = assertResultCode(
+ code = "def foo = (42: @foo1[A1, B1]): @foo2[A1, B1](4)(2)")(
+ parsedCode = "def foo = (42: @foo1[A1, B1]): @foo2[A1, B1](4)(2)",
+ typedCode = "def foo = ((42: @foo1[A1, B1]): @foo2[A1, B1](4)(2))",
+ wrap = true)
+
+ @Test def testAnnotated4 = assertResultCode(
+ code = "def foo = 42: @foo3[A1, B1](4)(2.0F, new foo1[A1, B1]())")(
+ parsedCode = "def foo = 42: @foo3[A1, B1](4)(2.0F, new foo1[A1, B1]())",
+ typedCode = "def foo = (42: @foo3[A1, B1](4)(2.0F, new foo1[A1, B1]()))",
+ wrap = true)
+
+ @Test def testAnnotated5 = assertPrintedCode(sm"""
+ |{
+ | val x = 5;
+ | (x: @unchecked) match {
+ | case ((_): scala.Int) => true
+ | case _ => false
+ | }
+ |}""")
+
+ @Test def testAnnotated8 = assertPrintedCode(sm"""
+ |{
+ | val x = 5;
+ | ((x: @unchecked): @foo3(4)(2.0F, new foo1[A1, B1]())) match {
+ | case _ => true
+ | }
+ |}""", wrapCode = true)
+}
+
+trait PackagePrintTests {
+ @Test def testPackage1 = assertPrintedCode(sm"""
+ |package foo.bar {
+ |
+ |}""", checkTypedTree = false)
+
+ @Test def testPackage2 = assertPrintedCode(sm"""
+ |package foo {
+ | class C
+ |
+ | object D
+ |}""", checkTypedTree = false)
+
+ //package object foo extends a with b
+ @Test def testPackage3 = assertPrintedCode(sm"""
+ |package foo {
+ | object `package` extends a with b
+ |}""", checkTypedTree = false)
+
+ //package object foo { def foo; val x = 1 }
+ @Test def testPackage4 = assertPrintedCode(sm"""
+ |package foo {
+ | object `package` {
+ | def foo: scala.Unit = ();
+ | val x = 1
+ | }
+ |}""", checkTypedTree = false)
+
+ //package object foo extends { val x = 1; type I = Int } with Any
+ @Test def testPackage5 = assertPrintedCode(sm"""
+ |package foo {
+ | object `package` extends {
+ | val x = 1;
+ | type I = Int
+ | } with AnyRef
+ |}""", checkTypedTree = false)
+}
+
+trait QuasiTreesPrintTests {
+ @Test def testQuasiIdent = assertTreeCode(q"*")("*")
+
+ @Test def testQuasiVal = assertTreeCode(q"val * : Unit = null")("val * : Unit = null")
+
+ @Test def testQuasiDef = assertTreeCode(q"def * : Unit = null")("def * : Unit = null")
+
+ @Test def testQuasiTrait = assertTreeCode(q"trait *")("trait *")
+
+ @Test def testQuasiClass = assertTreeCode(q"class *")("class *")
+
+ @Test def testQuasiClassWithPublicParams = assertTreeCode(q"class X(val x: Int, val s:String)")("class X(val x: Int, val s: String)")
+
+ @Test def testQuasiClassWithParams = assertTreeCode(q"class X(x: Int, s:String)")("class X(x: Int, s: String)")
+
+ @Test def testQuasiObject = assertTreeCode(q"object *")("object *")
+
+ @Test def testQuasiObjectWithBody = assertTreeCode(q"""object X{ def y = "test" }""")(sm"""
+ |object X {
+ | def y = "test"
+ |}""")
+
+ @Test def testQuasiClassWithBody = assertTreeCode(q"""class X{ def y = "test" }""")(sm"""
+ |class X {
+ | def y = "test"
+ |}""")
+
+ @Test def testQuasiTraitWithBody = assertTreeCode(q"""trait X{ def y = "test" }""")(sm"""
+ |trait X {
+ | def y = "test"
+ |}""")
+
+ @Test def testQuasiTraitWithSelfTypeAndBody = assertTreeCode(q"""trait X{ self: Order => def y = "test" }""")(sm"""
+ |trait X { self: Order =>
+ | def y = "test"
+ |}""")
+
+ @Test def testQuasiTraitWithSelf = assertTreeCode(q"""trait X{ self => def y = "test" }""")(sm"""
+ |trait X { self =>
+ | def y = "test"
+ |}""")
+
+ @Test def testQuasiCaseClassWithBody = assertTreeCode(q"""case class X() { def y = "test" }""")(sm"""
+ |case class X() {
+ | def y = "test"
+ |}""")
+
+ @Test def testQuasiCaseClassWithParamsAndBody = assertTreeCode(q"""case class X(x: Int, s: String){ def y = "test" }""")(sm"""
+ |case class X(x: Int, s: String) {
+ | def y = "test"
+ |}""")
+} \ No newline at end of file
diff --git a/test/pending/pos/t8363b.scala b/test/pending/pos/t8363b.scala
new file mode 100644
index 0000000000..393e2a0237
--- /dev/null
+++ b/test/pending/pos/t8363b.scala
@@ -0,0 +1,7 @@
+class C(a: Any)
+class Test {
+ def foo: Any = {
+ def form = 0
+ class C1 extends C({def x = form; ()})
+ }
+}
diff --git a/test/pending/run/t4728.check b/test/pending/run/t4728.check
deleted file mode 100644
index 7a754f414c..0000000000
--- a/test/pending/run/t4728.check
+++ /dev/null
@@ -1,2 +0,0 @@
-1
-2 \ No newline at end of file
diff --git a/test/scaladoc/resources/SI-8144.scala b/test/scaladoc/resources/SI-8144.scala
new file mode 100644
index 0000000000..7b225acb32
--- /dev/null
+++ b/test/scaladoc/resources/SI-8144.scala
@@ -0,0 +1,17 @@
+package some.pack
+
+class SomeType(arg: String) {
+
+ type TypeAlias = String
+
+ def >@<(): TypeAlias = "Tricky method name"
+
+ def >#<(): Int = 1
+
+}
+
+object SomeType {
+
+ val someVal = "Some arbitrary companion object value"
+
+}
diff --git a/test/scaladoc/resources/SI-8514.scala b/test/scaladoc/resources/SI-8514.scala
new file mode 100644
index 0000000000..4c5476604b
--- /dev/null
+++ b/test/scaladoc/resources/SI-8514.scala
@@ -0,0 +1,10 @@
+package a {
+ class DeveloperApi extends scala.annotation.StaticAnnotation
+
+ /** Some doc here */
+ @DeveloperApi
+ class A
+
+ @DeveloperApi
+ class B
+}
diff --git a/test/scaladoc/run/t8407.check b/test/scaladoc/run/t8407.check
new file mode 100644
index 0000000000..06c860b3eb
--- /dev/null
+++ b/test/scaladoc/run/t8407.check
@@ -0,0 +1,4 @@
+newSource:4: warning: not found: type $NotFound
+ * @usecase def zipWithIndex: $NotFound
+ ^
+Done.
diff --git a/test/scaladoc/run/t8407.scala b/test/scaladoc/run/t8407.scala
new file mode 100644
index 0000000000..2df9f4f1ac
--- /dev/null
+++ b/test/scaladoc/run/t8407.scala
@@ -0,0 +1,20 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ override def code = """
+class C {
+ /**
+ * @usecase def zipWithIndex: $NotFound
+ *
+ */
+ def zipWithIndex: Int = ???
+}
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(root: Package) = {
+ // just testing that it doesn't error out.
+ }
+}
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index 56328ea875..ef70e0bf21 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -149,7 +149,6 @@ object Test extends Properties("HtmlFactory") {
result
}
-
def shortComments(root: scala.xml.Node) =
XMLUtil.stripGroup(root).descendant.flatMap {
case e: scala.xml.Elem => {
@@ -417,7 +416,7 @@ object Test extends Properties("HtmlFactory") {
checkText("SI_5054_q1.scala")(
(None,"""def test(): Int""", true)
//Disabled because the full signature is now displayed
- //(None,"""def test(implicit lost: Int): Int""", false)
+ //(None, """def test(implicit lost: Int): Int""", false)
)
property("SI-5054: Use cases should keep their flags - final should not be lost") =
@@ -564,7 +563,7 @@ object Test extends Properties("HtmlFactory") {
property("Comment inheritance: Correct explicit inheritance for override") =
checkText("explicit-inheritance-override.scala")(
(Some("InheritDocDerived"),
- """def function[T](arg1: T, arg2: String): Double
+ """def function[T](arg1: T, arg2: String): Double
Starting line
Starting line
The base comment. And another sentence...
@@ -591,7 +590,7 @@ object Test extends Properties("HtmlFactory") {
property("Comment inheritance: Correct explicit inheritance for usecase") =
checkText("explicit-inheritance-usecase.scala")(
(Some("UseCaseInheritDoc"),
- """def function[T](arg1: T, arg2: String): Double
+ """def function[T](arg1: T, arg2: String): Double
[use case] Starting line
[use case] Starting line
The base comment. And another sentence...
@@ -740,5 +739,78 @@ object Test extends Properties("HtmlFactory") {
case node: scala.xml.Node => true
case _ => false
}
+
+ property("SI-8514: No inconsistencies") =
+ checkText("SI-8514.scala")(
+ (Some("a/package"),
+ """class A extends AnyRef
+ Some doc here
+ Some doc here
+ Annotations @DeveloperApi()
+ """, true),
+ (Some("a/package"),
+ """class B extends AnyRef
+ Annotations @DeveloperApi()
+ """, true)
+ )
+ }
+
+ // SI-8144
+ {
+ implicit class AttributesAwareNode(val node: NodeSeq) {
+
+ def \@(attrName: String): String =
+ node \ ("@" + attrName) text
+
+ def \@(attrName: String, attrValue: String): NodeSeq =
+ node filter { _ \ ("@" + attrName) exists (_.text == attrValue) }
+ }
+
+ implicit class AssertionAwareNode(node: scala.xml.NodeSeq) {
+
+ def assertTypeLink(expectedUrl: String): Boolean = {
+ val linkElement: NodeSeq = node \\ "div" \@ ("id", "definition") \\ "span" \@ ("class", "permalink") \ "a"
+ linkElement \@ "href" == expectedUrl && linkElement \@ "target" == "_top"
+ }
+
+ def assertMemberLink(group: String)(memberName: String, expectedUrl: String): Boolean = {
+ val linkElement: NodeSeq = node \\ "div" \@ ("id", group) \\ "li" \@ ("name", memberName) \\ "span" \@ ("class", "permalink") \ "a"
+ linkElement \@ "href" == expectedUrl && linkElement \@ "target" == "_top"
+ }
+
+ }
+
+ val files = createTemplates("SI-8144.scala")
+
+ def check(pagePath: String)(f: NodeSeq => org.scalacheck.Prop): org.scalacheck.Prop =
+ files(pagePath) match {
+ case node: scala.xml.Node => f(XMLUtil.stripGroup(node))
+ case _ => false
+ }
+
+ property("SI-8144: Members' permalink - package") = check("some/package.html") { node =>
+ ("type link" |: node.assertTypeLink("../index.html#some.package")) &&
+ ("member: some.pack" |: node.assertMemberLink("values")("some.pack", "../index.html#some.package@pack"))
+ }
+
+ property("SI-8144: Members' permalink - inner package") = check("some/pack/package.html") { node =>
+ ("type link" |: node.assertTypeLink("../../index.html#some.pack.package")) &&
+ ("member: SomeType (object)" |: node.assertMemberLink("values")("some.pack.SomeType", "../../index.html#some.pack.package@SomeType")) &&
+ ("member: SomeType (class)" |: node.assertMemberLink("types")("some.pack.SomeType", "../../index.html#some.pack.package@SomeTypeextendsAnyRef"))
+ }
+
+ property("SI-8144: Members' permalink - companion object") = check("some/pack/SomeType$.html") { node =>
+ ("type link" |: node.assertTypeLink("../../index.html#some.pack.SomeType$")) &&
+ ("member: someVal" |: node.assertMemberLink("allMembers")("some.pack.SomeType#someVal", "../../index.html#some.pack.SomeType$@someVal:String"))
+ }
+
+ property("SI-8144: Members' permalink - class") = check("some/pack/SomeType.html") { node =>
+ ("type link" |: node.assertTypeLink("../../index.html#some.pack.SomeType")) &&
+ ("constructor " |: node.assertMemberLink("constructors")("some.pack.SomeType#<init>", "../../index.html#some.pack.SomeType@<init>(arg:String):some.pack.SomeType")) &&
+ ( "member: type TypeAlias" |: node.assertMemberLink("types")("some.pack.SomeType.TypeAlias", "../../index.html#some.pack.SomeType@TypeAlias=String")) &&
+ ( "member: def >#<():Int " |: node.assertMemberLink("values")("some.pack.SomeType#>#<", "../../index.html#some.pack.SomeType@>#<():Int")) &&
+ ( "member: def >@<():TypeAlias " |: node.assertMemberLink("values")("some.pack.SomeType#>@<", "../../index.html#some.pack.SomeType@>@<():SomeType.this.TypeAlias"))
+ }
+
}
}