summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/backendBugUnapply.scala17
-rw-r--r--test/files/jvm/serialization-new.check54
-rw-r--r--test/files/jvm/serialization-new.scala67
-rw-r--r--test/files/jvm/serialization.check54
-rw-r--r--test/files/jvm/serialization.scala65
-rwxr-xr-xtest/files/jvm/t0632.check12
-rw-r--r--test/files/jvm/t0632.scala22
-rwxr-xr-xtest/files/jvm/t1118.check11
-rwxr-xr-xtest/files/jvm/t1118.scala21
-rw-r--r--test/files/jvm/t560bis.check2
-rw-r--r--test/files/jvm/t560bis.scala21
-rw-r--r--test/files/jvm/unittest_xml.scala101
-rwxr-xr-xtest/files/jvm/xml01.check8
-rw-r--r--test/files/jvm/xml01.scala182
-rw-r--r--test/files/jvm/xml02.scala78
-rwxr-xr-xtest/files/jvm/xml03syntax.check27
-rw-r--r--test/files/jvm/xml03syntax.scala97
-rw-r--r--test/files/jvm/xml04embed.check3
-rw-r--r--test/files/jvm/xml04embed.scala10
-rw-r--r--test/files/jvm/xmlattr.check18
-rw-r--r--test/files/jvm/xmlattr.scala70
-rw-r--r--test/files/jvm/xmlmore.check10
-rw-r--r--test/files/jvm/xmlmore.scala29
-rw-r--r--test/files/jvm/xmlpull.scala31
-rw-r--r--test/files/jvm/xmlstuff.check22
-rw-r--r--test/files/jvm/xmlstuff.scala181
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check8
-rw-r--r--test/files/neg/macro-abort.check4
-rw-r--r--test/files/neg/macro-abort/Macros_1.scala9
-rw-r--r--test/files/neg/macro-abort/Test_2.scala3
-rw-r--r--test/files/neg/macro-exception.check7
-rw-r--r--test/files/neg/macro-exception/Macros_1.scala9
-rw-r--r--test/files/neg/macro-exception/Test_2.scala3
-rw-r--r--test/files/neg/macro-invalidusage-presuper.check2
-rw-r--r--test/files/neg/t1011.check4
-rw-r--r--test/files/neg/t1011.scala127
-rw-r--r--test/files/neg/t1017.check4
-rw-r--r--test/files/neg/t1017.scala4
-rw-r--r--test/files/neg/t1845.scala12
-rw-r--r--test/files/neg/t1878-typer.check4
-rw-r--r--test/files/neg/t1878-typer.scala6
-rw-r--r--test/files/neg/t2796.check5
-rw-r--r--test/files/neg/t2796.flags2
-rw-r--r--test/files/neg/t2796.scala3
-rw-r--r--test/files/neg/t3160ambiguous.check6
-rw-r--r--test/files/neg/t3160ambiguous.scala10
-rw-r--r--test/files/neg/t3776.scala8
-rw-r--r--test/files/neg/t7020.check19
-rw-r--r--test/files/neg/t7020.flags1
-rw-r--r--test/files/neg/t7020.scala30
-rw-r--r--test/files/neg/t7185.check7
-rw-r--r--test/files/neg/t7185.scala3
-rw-r--r--test/files/neg/t7694b.check7
-rw-r--r--test/files/neg/t7752.check27
-rw-r--r--test/files/neg/t7752.scala26
-rw-r--r--test/files/neg/t935.check5
-rw-r--r--test/files/pos/matchStarlift.scala7
-rw-r--r--test/files/pos/t0422.scala16
-rw-r--r--test/files/pos/t0646.scala21
-rw-r--r--test/files/pos/t1014.scala15
-rw-r--r--test/files/pos/t1059.scala28
-rw-r--r--test/files/pos/t1203a.scala7
-rw-r--r--test/files/pos/t1626.scala4
-rw-r--r--test/files/pos/t1761.scala10
-rw-r--r--test/files/pos/t2281.scala41
-rw-r--r--test/files/pos/t2698.scala11
-rw-r--r--test/files/pos/t3160.scala6
-rw-r--r--test/files/pos/t4760.scala34
-rw-r--r--test/files/pos/t5858.scala3
-rw-r--r--test/files/pos/t6201.scala13
-rw-r--r--test/files/pos/t6897.scala6
-rw-r--r--test/files/pos/t7014/ThreadSafety.java9
-rw-r--r--test/files/pos/t7014/ThreadSafetyLevel.java8
-rw-r--r--test/files/pos/t7014/t7014.scala4
-rw-r--r--test/files/pos/t715/meredith_1.scala98
-rw-r--r--test/files/pos/t715/runner_2.scala3
-rw-r--r--test/files/pos/t7486-named.scala8
-rw-r--r--test/files/pos/t7486.scala (renamed from test/pending/pos/t7486.scala)0
-rw-r--r--test/files/pos/t7694.scala40
-rw-r--r--test/files/pos/t7716.scala16
-rw-r--r--test/files/pos/t7782.scala25
-rw-r--r--test/files/pos/t7782b.scala25
-rw-r--r--test/files/pos/t880.scala6
-rw-r--r--test/files/pos/t942/Amount_1.java5
-rw-r--r--test/files/pos/t942/Test_2.scala3
-rw-r--r--test/files/presentation/partial-fun.check2
-rw-r--r--test/files/presentation/partial-fun/Runner.scala10
-rw-r--r--test/files/presentation/partial-fun/partial-fun.check1
-rw-r--r--test/files/presentation/partial-fun/src/PartialFun.scala5
-rw-r--r--test/files/run/WeakHashSetTest.scala174
-rw-r--r--test/files/run/analyzerPlugins.scala6
-rw-r--r--test/files/run/deprecate-early-type-defs.check3
-rw-r--r--test/files/run/deprecate-early-type-defs.flags1
-rw-r--r--test/files/run/deprecate-early-type-defs.scala1
-rw-r--r--test/files/run/existential-rangepos.check13
-rw-r--r--test/files/run/existential-rangepos.scala13
-rw-r--r--test/files/run/fors.check46
-rw-r--r--test/files/run/fors.scala97
-rw-r--r--test/files/run/io-position.checkbin126 -> 0 bytes
-rw-r--r--test/files/run/io-position.scala11
-rw-r--r--test/files/run/json.check21
-rw-r--r--test/files/run/json.scala287
-rw-r--r--test/files/run/jtptest.check7
-rw-r--r--test/files/run/jtptest.scala17
-rw-r--r--test/files/run/macro-auto-duplicate.check1
-rw-r--r--test/files/run/macro-auto-duplicate/Macros_1.scala17
-rw-r--r--test/files/run/macro-auto-duplicate/Test_2.scala3
-rw-r--r--test/files/run/macro-duplicate/Impls_Macros_1.scala2
-rw-r--r--test/files/run/nodebuffer-array.check3
-rw-r--r--test/files/run/nodebuffer-array.scala15
-rw-r--r--test/files/run/packrat1.check7
-rw-r--r--test/files/run/packrat1.scala47
-rw-r--r--test/files/run/packrat2.check7
-rw-r--r--test/files/run/packrat2.scala57
-rw-r--r--test/files/run/packrat3.check7
-rw-r--r--test/files/run/packrat3.scala51
-rw-r--r--test/files/run/parserFilter.check9
-rw-r--r--test/files/run/parserFilter.scala15
-rw-r--r--test/files/run/parserForFilter.check1
-rw-r--r--test/files/run/parserForFilter.scala12
-rw-r--r--test/files/run/parserJavaIdent.check26
-rw-r--r--test/files/run/parserJavaIdent.scala26
-rw-r--r--test/files/run/parserNoSuccessMessage.check20
-rw-r--r--test/files/run/parserNoSuccessMessage.scala19
-rw-r--r--test/files/run/reflect-priv-ctor.check1
-rw-r--r--test/files/run/reflect-priv-ctor.scala22
-rw-r--r--test/files/run/reflection-magicsymbols-invoke.check2
-rw-r--r--test/files/run/repl-backticks.check2
-rw-r--r--test/files/run/repl-backticks.scala18
-rw-r--r--test/files/run/repl-trim-stack-trace.scala18
-rw-r--r--test/files/run/t0486.check8
-rw-r--r--test/files/run/t0486.scala24
-rwxr-xr-xtest/files/run/t0663.check1
-rw-r--r--test/files/run/t0663.scala6
-rw-r--r--test/files/run/t0700.check2
-rw-r--r--test/files/run/t0700.scala24
-rw-r--r--test/files/run/t1079.scala3
-rw-r--r--test/files/run/t1100.check4
-rw-r--r--test/files/run/t1100.scala17
-rw-r--r--test/files/run/t1500.check3
-rw-r--r--test/files/run/t1500.scala46
-rw-r--r--test/files/run/t1501.check3
-rw-r--r--test/files/run/t1501.scala56
-rwxr-xr-xtest/files/run/t1620.check6
-rw-r--r--test/files/run/t1620.scala16
-rw-r--r--test/files/run/t1773.scala12
-rwxr-xr-xtest/files/run/t2124.check1
-rw-r--r--test/files/run/t2124.scala25
-rwxr-xr-xtest/files/run/t2125.check1
-rw-r--r--test/files/run/t2125.scala25
-rw-r--r--test/files/run/t2276.check8
-rw-r--r--test/files/run/t2276.scala24
-rw-r--r--test/files/run/t2354.scala17
-rw-r--r--test/files/run/t2721.check2
-rw-r--r--test/files/run/t2721.scala12
-rw-r--r--test/files/run/t3705.scala17
-rw-r--r--test/files/run/t3886.scala11
-rw-r--r--test/files/run/t4124.check4
-rw-r--r--test/files/run/t4124.scala24
-rw-r--r--test/files/run/t4138.check2
-rw-r--r--test/files/run/t4138.scala6
-rw-r--r--test/files/run/t4387.scala12
-rw-r--r--test/files/run/t4929.check1
-rw-r--r--test/files/run/t4929.scala43
-rw-r--r--test/files/run/t5052.scala6
-rw-r--r--test/files/run/t5115.scala14
-rw-r--r--test/files/run/t5514.check19
-rw-r--r--test/files/run/t5514.scala35
-rw-r--r--test/files/run/t5843.check9
-rw-r--r--test/files/run/t5843.scala15
-rw-r--r--test/files/run/t6392b.check2
-rw-r--r--test/files/run/t6939.scala13
-rw-r--r--test/files/run/t6989.check24
-rw-r--r--test/files/run/t7074.check9
-rw-r--r--test/files/run/t7074.scala15
-rw-r--r--test/files/run/t7510.check (renamed from test/files/jvm/xml02.check)0
-rw-r--r--test/files/run/t7510/Ann_1.java4
-rw-r--r--test/files/run/t7510/Test_2.scala9
-rw-r--r--test/files/run/t7775.scala17
-rw-r--r--test/files/run/t7779.scala67
-rw-r--r--test/files/run/t7791-script-linenums.check1
-rw-r--r--test/files/run/t7791-script-linenums.scala16
-rw-r--r--test/files/run/t7791-script-linenums.script8
-rw-r--r--test/files/run/t7805-repl-i.check11
-rw-r--r--test/files/run/t7805-repl-i.scala42
-rw-r--r--test/files/run/t7805-repl-i.script1
-rw-r--r--test/files/run/t7817-tree-gen.check104
-rw-r--r--test/files/run/t7817-tree-gen.flags1
-rw-r--r--test/files/run/t7817-tree-gen.scala65
-rw-r--r--test/files/run/t7817.scala31
-rw-r--r--test/files/run/tailcalls.scala13
-rw-r--r--test/files/run/toolbox_current_run_compiles.check (renamed from test/files/run/t1079.check)1
-rw-r--r--test/files/run/toolbox_current_run_compiles.scala28
-rw-r--r--test/files/run/typed-annotated.check1
-rw-r--r--test/files/run/typed-annotated/Macros_1.scala17
-rw-r--r--test/files/run/typed-annotated/Test_2.scala3
-rw-r--r--test/files/run/unittest_io.scala42
-rw-r--r--test/files/run/xml-attribute.check12
-rw-r--r--test/files/run/xml-attribute.scala37
-rw-r--r--test/files/run/xml-loop-bug.scala14
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala293
-rw-r--r--test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala147
-rw-r--r--test/files/scalacheck/quasiquotes/PatternConstructionProps.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala21
-rw-r--r--test/files/scalacheck/quasiquotes/TermConstructionProps.scala213
-rw-r--r--test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala84
-rw-r--r--test/files/scalacheck/quasiquotes/Test.scala2
-rw-r--r--test/files/scalacheck/quasiquotes/TypeConstructionProps.scala11
-rw-r--r--test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala13
-rw-r--r--test/junit/scala/tools/nsc/util/StackTraceTest.scala159
-rw-r--r--test/pending/pos/t7778/Foo_1.java6
-rw-r--r--test/pending/pos/t7778/Test_2.scala3
-rw-r--r--test/pending/pos/treecheckers.flags1
-rw-r--r--test/pending/pos/treecheckers/c1.scala12
-rw-r--r--test/pending/pos/treecheckers/c2.scala1
-rw-r--r--test/pending/pos/treecheckers/c3.scala8
-rw-r--r--test/pending/pos/treecheckers/c4.scala9
-rw-r--r--test/pending/pos/treecheckers/c5.scala3
-rw-r--r--test/pending/pos/treecheckers/c6.scala4
-rw-r--r--test/pending/run/t7733.check (renamed from test/files/jvm/backendBugUnapply.check)1
-rw-r--r--test/pending/run/t7733/Separate_1.scala5
-rw-r--r--test/pending/run/t7733/Test_2.scala9
222 files changed, 1853 insertions, 3499 deletions
diff --git a/test/files/jvm/backendBugUnapply.scala b/test/files/jvm/backendBugUnapply.scala
deleted file mode 100644
index 45ee6f7d4f..0000000000
--- a/test/files/jvm/backendBugUnapply.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-object Test {
- import scala.xml.{Node,UnprefixedAttribute}
-
- def domatch(x:Node) =
- x match {
- case Node("foo", UnprefixedAttribute("bar", z, _), _*) => z
- case _ => null
- }
-
- def main(args: Array[String]): Unit = {
- println(domatch(<foo bar="baz"><hi/></foo>))
- println(domatch(<foo bingo="donkey"><hi/></foo>))
- //
- // assert(domatch(<foo bar="baz"><hi/></foo>).toString == "baz")
- // assert(domatch(<foo bar="baz2"><hi/></foo>) == null)//, domatch(<foo bar="baz2"><hi/></foo>))
- }
-}
diff --git a/test/files/jvm/serialization-new.check b/test/files/jvm/serialization-new.check
index f886cfe29c..e2d2e4aee6 100644
--- a/test/files/jvm/serialization-new.check
+++ b/test/files/jvm/serialization-new.check
@@ -220,60 +220,6 @@ x = TrieMap(1 -> one, 2 -> two, 3 -> three)
y = TrieMap(1 -> one, 2 -> two, 3 -> three)
x equals y: true, y equals x: true
-x = xml:src="hello"
-y = xml:src="hello"
-x equals y: true, y equals x: true
-
-x = <title></title>
-y = <title></title>
-x equals y: true, y equals x: true
-
-x = <html><title>title</title><body></body></html>
-y = <html><title>title</title><body></body></html>
-x equals y: true, y equals x: true
-
-x = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-y = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-x equals y: true, y equals x: true
-
x = Tim
y = Tim
x equals y: true, y equals x: true
diff --git a/test/files/jvm/serialization-new.scala b/test/files/jvm/serialization-new.scala
index 1522fc8e27..1b5e856645 100644
--- a/test/files/jvm/serialization-new.scala
+++ b/test/files/jvm/serialization-new.scala
@@ -419,70 +419,6 @@ object Test3_mutable {
}
}
-
-//############################################################################
-// Test classes in package "scala.xml"
-
-object Test4_xml {
- import scala.xml.{Attribute, Document, Elem, Null, PrefixedAttribute, Text}
-
- case class Person(name: String, age: Int)
-
- try {
- // Attribute
- val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null)
- val _a1: Attribute = read(write(a1))
- check(a1, _a1)
-
- // Document
- val d1 = new Document
- d1.docElem = <title></title>
- d1.encoding = Some("UTF-8")
- val _d1: Document = read(write(d1))
- check(d1, _d1)
-
- // Elem
- val e1 = <html><title>title</title><body></body></html>;
- val _e1: Elem = read(write(e1))
- check(e1, _e1)
-
- class AddressBook(a: Person*) {
- private val people: List[Person] = a.toList
- def toXHTML =
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- { for (p <- people) yield
- <tr>
- <td> { p.name } </td>
- <td> { p.age.toString() } </td>
- </tr> }
- </table>;
- }
-
- val people = new AddressBook(
- Person("Tom", 20),
- Person("Bob", 22),
- Person("James", 19))
-
- val e2 =
- <html>
- <body>
- { people.toXHTML }
- </body>
- </html>;
- val _e2: Elem = read(write(e2))
- check(e2, _e2)
- }
- catch {
- case e: Exception =>
- println("Error in Test4_xml: " + e)
- throw e
- }
-}
-
//############################################################################
// Test user-defined classes WITHOUT nesting
@@ -594,11 +530,10 @@ object Test8 {
// Test code
object Test {
- def main(args: Array[String]) {
+ def main(args: Array[String]): Unit = {
Test1_scala
Test2_immutable
Test3_mutable
- Test4_xml
Test5
Test6
Test7
diff --git a/test/files/jvm/serialization.check b/test/files/jvm/serialization.check
index f886cfe29c..e2d2e4aee6 100644
--- a/test/files/jvm/serialization.check
+++ b/test/files/jvm/serialization.check
@@ -220,60 +220,6 @@ x = TrieMap(1 -> one, 2 -> two, 3 -> three)
y = TrieMap(1 -> one, 2 -> two, 3 -> three)
x equals y: true, y equals x: true
-x = xml:src="hello"
-y = xml:src="hello"
-x equals y: true, y equals x: true
-
-x = <title></title>
-y = <title></title>
-x equals y: true, y equals x: true
-
-x = <html><title>title</title><body></body></html>
-y = <html><title>title</title><body></body></html>
-x equals y: true, y equals x: true
-
-x = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-y = <html>
- <body>
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- <tr>
- <td> Tom </td>
- <td> 20 </td>
- </tr><tr>
- <td> Bob </td>
- <td> 22 </td>
- </tr><tr>
- <td> James </td>
- <td> 19 </td>
- </tr>
- </table>
- </body>
- </html>
-x equals y: true, y equals x: true
-
x = Tim
y = Tim
x equals y: true, y equals x: true
diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala
index a64b7115fa..2bb9db3f72 100644
--- a/test/files/jvm/serialization.scala
+++ b/test/files/jvm/serialization.scala
@@ -420,70 +420,6 @@ object Test3_mutable {
}
}
-
-//############################################################################
-// Test classes in package "scala.xml"
-
-object Test4_xml {
- import scala.xml.{Attribute, Document, Elem, Null, PrefixedAttribute, Text}
-
- case class Person(name: String, age: Int)
-
- try {
- // Attribute
- val a1 = new PrefixedAttribute("xml", "src", Text("hello"), Null)
- val _a1: Attribute = read(write(a1))
- check(a1, _a1)
-
- // Document
- val d1 = new Document
- d1.docElem = <title></title>
- d1.encoding = Some("UTF-8")
- val _d1: Document = read(write(d1))
- check(d1, _d1)
-
- // Elem
- val e1 = <html><title>title</title><body></body></html>;
- val _e1: Elem = read(write(e1))
- check(e1, _e1)
-
- class AddressBook(a: Person*) {
- private val people: List[Person] = a.toList
- def toXHTML =
- <table cellpadding="2" cellspacing="0">
- <tr>
- <th>Last Name</th>
- <th>First Name</th>
- </tr>
- { for (p <- people) yield
- <tr>
- <td> { p.name } </td>
- <td> { p.age.toString() } </td>
- </tr> }
- </table>;
- }
-
- val people = new AddressBook(
- Person("Tom", 20),
- Person("Bob", 22),
- Person("James", 19))
-
- val e2 =
- <html>
- <body>
- { people.toXHTML }
- </body>
- </html>;
- val _e2: Elem = read(write(e2))
- check(e2, _e2)
- }
- catch {
- case e: Exception =>
- println("Error in Test4_xml: " + e)
- throw e
- }
-}
-
//############################################################################
// Test user-defined classes WITHOUT nesting
@@ -600,7 +536,6 @@ object Test {
Test1_scala
Test2_immutable
Test3_mutable
- Test4_xml
Test5
Test6
Test7
diff --git a/test/files/jvm/t0632.check b/test/files/jvm/t0632.check
deleted file mode 100755
index 681bc9da92..0000000000
--- a/test/files/jvm/t0632.check
+++ /dev/null
@@ -1,12 +0,0 @@
-<foo x="&amp;"/>
-<foo x="&amp;"/>
-<foo x="&amp;"/>
-<foo x="&amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;amp;"/>
-<foo x="&amp;&amp;"/>
-<foo x="&amp;&amp;"/>
-<foo x="&amp;&amp;"/>
-<foo x="&amp;&amp;"/>
diff --git a/test/files/jvm/t0632.scala b/test/files/jvm/t0632.scala
deleted file mode 100644
index a2bb5aa7f4..0000000000
--- a/test/files/jvm/t0632.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-object Test {
-import scala.io.Source.fromString
-import scala.xml.parsing.ConstructingParser.fromSource
-import scala.xml.TopScope
- def parse(s:String) = fromSource(fromString(s), false).element(TopScope)
- def main(argv : Array[String]) : Unit = {
-
- println(parse("<foo x='&amp;'/>"))
- println(xml.XML.loadString("<foo x='&amp;'/>"))
- println(<foo x="&amp;"/>)
- println(<foo x={ "&" }/>)
-
- println(xml.XML.loadString("<foo x='&amp;amp;'/>"))
- println(parse("<foo x='&amp;amp;'/>"))
- println(<foo x="&amp;amp;"/>)
- println(<foo x={ "&amp;" }/>)
- println(xml.XML.loadString("<foo x='&amp;&amp;'/>"))
- println(parse("<foo x='&amp;&amp;'/>"))
- println(<foo x="&amp;&amp;"/>)
- println(<foo x={ "&&" }/>)
- }
-}
diff --git a/test/files/jvm/t1118.check b/test/files/jvm/t1118.check
deleted file mode 100755
index d676b413c9..0000000000
--- a/test/files/jvm/t1118.check
+++ /dev/null
@@ -1,11 +0,0 @@
-
-<hi/> <!-- literal short -->
-<there></there> <!-- literal long -->
-<guys who="you all"></guys> <!-- literal long with attribute-->
-<hows it="going"/> <!-- literal short with attribute -->
-<this>is pretty cool</this> <!-- literal not empty -->
-
-<emptiness></emptiness> <!--programmatic long-->
-<vide/> <!--programmatic short-->
-<elem attr="value"/> <!--programmatic short with attribute-->
-<elem2 attr2="value2"></elem2> <!--programmatic long with attribute-->
diff --git a/test/files/jvm/t1118.scala b/test/files/jvm/t1118.scala
deleted file mode 100755
index 3c86547241..0000000000
--- a/test/files/jvm/t1118.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-import scala.xml._
-
-object Test {
- def main(args: Array[String]) {
- println(<xml:group>
-<hi/> <!-- literal short -->
-<there></there> <!-- literal long -->
-<guys who="you all"></guys> <!-- literal long with attribute-->
-<hows it="going"/> <!-- literal short with attribute -->
-<this>is pretty cool</this> <!-- literal not empty -->
-</xml:group>)
-
- println(Elem(null, "emptiness", Null, TopScope, false) ++ Text(" ") ++ Comment("programmatic long"))
-
- println(Elem(null, "vide", Null, TopScope, true) ++ Text(" ") ++ Comment("programmatic short"))
-
- println(Elem(null, "elem", Attribute("attr", Text("value"), Null), TopScope, true) ++ Text(" ") ++ Comment ("programmatic short with attribute"))
-
- println(Elem(null, "elem2", Attribute("attr2", Text("value2"), Null), TopScope, false) ++ Text(" ") ++ Comment ("programmatic long with attribute"))
- }
-} \ No newline at end of file
diff --git a/test/files/jvm/t560bis.check b/test/files/jvm/t560bis.check
deleted file mode 100644
index 91eb4c19a2..0000000000
--- a/test/files/jvm/t560bis.check
+++ /dev/null
@@ -1,2 +0,0 @@
-cool!
-cool!
diff --git a/test/files/jvm/t560bis.scala b/test/files/jvm/t560bis.scala
deleted file mode 100644
index 21eb8dde28..0000000000
--- a/test/files/jvm/t560bis.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-object Test {
-import scala.xml._;
-
- def bar(args: Seq[String]) = args match {
- case Seq(a,b,c,d @ _*) => Console.println("cool!")
- case _ => Console.println("bah")
- }
- def foo(args: List[String]) =
- Elem(null,"bla",Null, TopScope, minimizeEmpty = true, (args map {x => Text(x)}):_*) match {
- case Elem(_,_,_,_,Text("1"),_*) =>
- Console.println("cool!")
- case _ =>
- Console.println("bah")
- }
-
- def main(args: Array[String]) = {
- val li = List("1","2","3","4")
- bar(li)
- foo(li)
- }
-}
diff --git a/test/files/jvm/unittest_xml.scala b/test/files/jvm/unittest_xml.scala
deleted file mode 100644
index 106334e625..0000000000
--- a/test/files/jvm/unittest_xml.scala
+++ /dev/null
@@ -1,101 +0,0 @@
-import scala.xml.{ MetaData, Null, Utility, PrefixedAttribute, UnprefixedAttribute }
-
-object Test {
-
- def main(args:Array[String]) = {
- MetaDataTest.run()
- UtilityTest.run()
- }
-
- object MetaDataTest {
-
- import scala.xml.{ TopScope, NamespaceBinding, Node, Atom, Text }
-
- def domatch(x:Node): Node = {
- x match {
- case Node("foo", md @ UnprefixedAttribute(_, value, _), _*) if !value.isEmpty =>
- md("bar")(0)
- case _ => new Atom(3)
- }
- }
-
- def run() {
-
- var x: MetaData = Null
- var s: NamespaceBinding = TopScope
-
- // testing method def apply(uri:String, scp:NamespaceBinding, k:String): Seq[Node]
- // def apply(k:String): Seq[Node]
-
- assert(null == x("za://foo.com", s, "bar" ), "absent element (prefixed) 1")
- assert(null == x("bar"), "absent element (unprefix) 1")
-
- assert(None == x.get("za://foo.com", s, "bar" ), "absent element (prefixed) 2")
- assert(None == x.get("bar"), "absent element (unprefix) 2")
-
- x = new PrefixedAttribute("zo","bar", new Atom(42), x)
- s = new NamespaceBinding("zo","za://foo.com",s)
-
- assert(new Atom(42) == x("za://foo.com", s, "bar" ), "present element (prefixed) 3")
- assert(null == x("bar"), "present element (unprefix) 3")
-
- assert(Some(new Atom(42)) == x.get("za://foo.com", s, "bar" ), "present element (prefixed) 4")
- assert(None == x.get("bar"), "present element (unprefix) 4")
-
- x = new UnprefixedAttribute("bar","meaning", x)
-
- assert(null == x(null, s, "bar"), "present element (prefixed) 5")
- assert(Text("meaning") == x("bar"), "present element (unprefix) 5")
-
- assert(None == x.get(null, s, "bar" ), "present element (prefixed) 6")
- assert(Some(Text("meaning")) == x.get("bar"), "present element (unprefix) 6")
-
- val z = <foo bar="gar"/>
- val z2 = <foo/>
-
- assert(Text("gar") == domatch(z), "attribute extractor 1")
- assert(new Atom(3) == domatch(z2), "attribute extractor 2")
-
- }
- }
-
- object UtilityTest {
- def run() {
- assert(Utility.isNameStart('b'))
- assert(!Utility.isNameStart(':'))
-
- val x = <foo>
- <toomuchws/>
- </foo>
-
- val y = xml.Utility.trim(x)
-
- assert(1 == (y match { case <foo><toomuchws/></foo> => 1 }), "trim 1")
-
- val x2 = <foo>
- <toomuchws> a b b a </toomuchws>
- </foo>
-
- val y2 = xml.Utility.trim(x2)
-
- assert(2 == (y2 match { case <foo><toomuchws>a b b a</toomuchws></foo> => 2 }), "trim 2")
-
- val z = <bar>''</bar>
- val z1 = z.toString
-
- assert("<bar>''</bar>" == z1, "apos unescaped")
-
- val q = xml.Utility.sort(<a g='3' j='2' oo='2' a='2'/>)
- assert(" a=\"2\" g=\"3\" j=\"2\" oo=\"2\"" == xml.Utility.sort(q.attributes).toString)
-
- val pp = new xml.PrettyPrinter(80,5)
- assert("<a a=\"2\" g=\"3\" j=\"2\" oo=\"2\"/>" == pp.format(q))
-
- <hi>
- <there/>
- <guys/>
- </hi>.hashCode // Bug #777
- }
- }
-
-}
diff --git a/test/files/jvm/xml01.check b/test/files/jvm/xml01.check
deleted file mode 100755
index d78e6df410..0000000000
--- a/test/files/jvm/xml01.check
+++ /dev/null
@@ -1,8 +0,0 @@
-equality
-xpath \
-xpath \\ DESCENDANTS
-<book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book>
--- group nodes
-<f><a/><b/><c/></f>
-<a/><f><a/><b/><c/></f><a/><b/><c/>
-attribute value normalization
diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala
deleted file mode 100644
index 2b456f5ff5..0000000000
--- a/test/files/jvm/xml01.scala
+++ /dev/null
@@ -1,182 +0,0 @@
-import java.io.StringReader
-import org.xml.sax.InputSource
-
-import scala.xml._
-
-object Test extends App {
- def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem =
- scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*)
- val e: scala.xml.MetaData = Null //Node.NoAttributes
- val sc: scala.xml.NamespaceBinding = TopScope
-
- val xmlFile1 = "<hello><world/></hello>";
- val isrc1 = new InputSource(new StringReader(xmlFile1))
- val parsedxml1 = XML.load(isrc1)
- val isrc11 = new InputSource(new StringReader(xmlFile1))
- val parsedxml11 = XML.load(isrc11)
-
- val c = new Node {
- def label = "hello"
- override def hashCode() =
- Utility.hashCode(prefix, label, attributes.hashCode(), scope.hashCode(), child);
- def child = Elem(null, "world", e, sc);
- //def attributes = e;
- override def text = ""
- }
-
- println("equality")
- assert(c == parsedxml11)
- assert(parsedxml1 == parsedxml11)
- assert(List(parsedxml1) sameElements List(parsedxml11))
- assert(Array(parsedxml1).toList sameElements List(parsedxml11))
-
- val x2 = "<book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book>";
-
- val i = new InputSource(new StringReader(x2))
- val x2p = XML.load(i)
-
- assert(x2p == Elem(null, "book" , e, sc,
- Elem(null, "author", e, sc,Text("Peter Buneman")),
- Elem(null, "author", e, sc,Text("Dan Suciu")),
- Elem(null, "title" , e, sc,Text("Data on ze web"))))
-
- val xmlFile2 = "<bib><book><author>Peter Buneman</author><author>Dan Suciu</author><title>Data on ze web</title></book><book><author>John Mitchell</author><title>Foundations of Programming Languages</title></book></bib>";
- val isrc2 = new InputSource(new StringReader(xmlFile2))
- val parsedxml2 = XML.load(isrc2)
-
- println("xpath \\")
-
- assert(parsedxml1 \ "_" sameElements List(Elem(null,"world", e, sc)))
-
- assert(parsedxml1 \ "world" sameElements List(Elem(null,"world", e, sc)))
-
- assert(
- (parsedxml2 \ "_") sameElements List(
- Elem(null,"book", e, sc,
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"title" , e, sc, Text("Data on ze web"))),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))))
- )
- assert((parsedxml2 \ "author").isEmpty)
-
- assert(
- (parsedxml2 \ "book") sameElements List(
- Elem(null,"book",e,sc,
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"title" , e, sc, Text("Data on ze web"))),
- Elem(null,"book",e,sc,
- Elem(null,"author", e, sc, Text("John Mitchell")),
- Elem(null,"title" , e, sc, Text("Foundations of Programming Languages")))
- )
- )
-
- assert(
- (parsedxml2 \ "_" \ "_") sameElements List(
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"title" , e, sc, Text("Data on ze web")),
- Elem(null,"author", e, sc, Text("John Mitchell")),
- Elem(null,"title" , e, sc, Text("Foundations of Programming Languages"))
- )
- )
-
- assert(
- (parsedxml2 \ "_" \ "author") sameElements List(
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"author", e, sc, Text("John Mitchell"))
- )
- )
-
- assert((parsedxml2 \ "_" \ "_" \ "author").isEmpty)
-
- Console.println("xpath \\\\ DESCENDANTS");
-
- assert(
- (parsedxml2 \\ "author") sameElements List(
- Elem(null,"author", e, sc, Text("Peter Buneman")),
- Elem(null,"author", e, sc, Text("Dan Suciu")),
- Elem(null,"author", e, sc, Text("John Mitchell"))
- )
- )
-
- assert(
- (parsedxml2 \\ "title") sameElements List(
- Elem(null,"title", e, sc, Text("Data on ze web")),
- Elem(null,"title", e, sc, Text("Foundations of Programming Languages")))
- )
-
-
- println(
- (parsedxml2 \\ "book" ){ n:Node => (n \ "title") xml_== "Data on ze web" }
- )
-
- assert(
- ((new NodeSeq { val theSeq = List( parsedxml2 ) }) \\ "_") sameElements List(
- Elem(null,"bib",e,sc,
- Elem(null,"book",e,sc,
- Elem(null, "author", e, sc, Text("Peter Buneman")),
- Elem(null, "author", e, sc, Text("Dan Suciu")),
- Elem(null, "title" , e, sc, Text("Data on ze web"))),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages")))),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("Peter Buneman")),
- Elem(null,"author",e,sc,Text("Dan Suciu")),
- Elem(null,"title",e,sc,Text("Data on ze web"))),
- Elem(null,"author",e,sc,Text("Peter Buneman")),
- Elem(null,"author",e,sc,Text("Dan Suciu")),
- Elem(null,"title",e,sc,Text("Data on ze web")),
- Elem(null,"book",e,sc,
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))),
- Elem(null,"author",e,sc,Text("John Mitchell")),
- Elem(null,"title",e,sc,Text("Foundations of Programming Languages"))
- )
- )
-
- // test group node
- Console println "-- group nodes"
- val zx1: Node = Group { <a/><b/><c/> }
- val zy1 = <f>{zx1}</f>
- Console println zy1.toString()
-
- val zx2: Node = Group { List(<a/>,zy1,zx1) }
- Console println zx2.toString()
-
- val zz1 = <xml:group><a/><b/><c/></xml:group>
-
- assert(zx1 xml_== zz1)
- assert(zz1.length == 3)
-
- // unparsed
-
- println("attribute value normalization")
- val xmlAttrValueNorm = "<personne id='p0003' nom='&#x015e;ahingöz' />";
- {
- val isrcA = new InputSource( new StringReader(xmlAttrValueNorm) );
- val parsedxmlA = XML.load(isrcA);
- val c = (parsedxmlA \ "@nom").text.charAt(0);
- assert(c == '\u015e');
- }
- // buraq: if the following test fails with 'character x not allowed', it is
- // related to the mutable variable in a closures in MarkupParser.parsecharref
- {
- val isr = scala.io.Source.fromString(xmlAttrValueNorm);
- val pxmlB = scala.xml.parsing.ConstructingParser.fromSource(isr,false);
- val parsedxmlB = pxmlB.element(TopScope);
- val c = (parsedxmlB \ "@nom").text.charAt(0);
- assert(c == '\u015e');
- }
-
- // #60 test by round trip
-
- val p = scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString("<foo bar:attr='&amp;'/>"),true)
- val n = p.element(new scala.xml.NamespaceBinding("bar","BAR",scala.xml.TopScope))(0)
- assert( n.attributes.get("BAR", n, "attr").nonEmpty)
-}
diff --git a/test/files/jvm/xml02.scala b/test/files/jvm/xml02.scala
deleted file mode 100644
index b830a0e694..0000000000
--- a/test/files/jvm/xml02.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-object Test {
-
- def main(args: Array[String]) {
- XmlEx.run()
- XmlEy.run()
- XmlPat.run()
- DodgyNamespace.run()
- }
-
- import scala.xml.{NodeSeq, Utility}
- import NodeSeq.seqToNodeSeq
-
- val ax = <hello foo="bar" x:foo="baz" xmlns:x="the namespace from outer space">
- <world/>
- </hello>
-
- val cx = <z:hello foo="bar" xmlns:z="z" x:foo="baz" xmlns:x="the namespace from outer space">
- crazy text world
- </z:hello>
-
- val bx = <hello foo="bar&amp;x"></hello>
-
- object XmlEx {
-
- def run() {
- assert((ax \ "@foo") xml_== "bar") // uses NodeSeq.view!
- assert((ax \ "@foo") xml_== xml.Text("bar")) // dto.
- assert((bx \ "@foo") xml_== "bar&x") // dto.
- assert((bx \ "@foo") xml_sameElements List(xml.Text("bar&x")))
- assert("<hello foo=\"bar&amp;x\"></hello>" == bx.toString)
- }
- }
-
- object XmlEy {
- def run() {
- val z = ax \ "@{the namespace from outer space}foo"
- assert((ax \ "@{the namespace from outer space}foo") xml_== "baz")
- assert((cx \ "@{the namespace from outer space}foo") xml_== "baz")
-
- try {
- ax \ "@"
- assert(false)
- } catch {
- case _: IllegalArgumentException =>
- }
- try {
- ax \ "@{"
- assert(false)
- } catch {
- case _: IllegalArgumentException =>
- }
- try {
- ax \ "@{}"
- assert(false)
- } catch {
- case _: IllegalArgumentException =>
- }
-
- }
- }
-
- object XmlPat {
- def run() {
- assert(<hello/> match { case <hello/> => true; case _ => false; })
- assert(<x:ga xmlns:x="z"/> match { case <x:ga/> => true; case _ => false; });
- assert(Utility.trim(cx) match { case n @ <hello>crazy text world</hello> if (n \ "@foo") xml_== "bar" => true; })
- assert(Utility.trim(cx) match { case n @ <z:hello>crazy text world</z:hello> if (n \ "@foo") xml_== "bar" => true; })
- }
- }
-
- object DodgyNamespace {
- def run() {
- val x = <flog xmlns:ee="http://ee.com"><foo xmlns:dog="http://dog.com"><dog:cat/></foo></flog>
- assert(x.toString.matches(".*xmlns:dog=\"http://dog.com\".*"));
- }
- }
-
-}
diff --git a/test/files/jvm/xml03syntax.check b/test/files/jvm/xml03syntax.check
deleted file mode 100755
index 599cbad686..0000000000
--- a/test/files/jvm/xml03syntax.check
+++ /dev/null
@@ -1,27 +0,0 @@
-true
-true
-true
-<hello>world</hello>
-true
-<hello>1.5</hello>
-true
-<hello>5</hello>
-true
-<hello>true</hello>
-true
-<hello>5</hello>
-true
-<hello>27</hello>
-true
-<hello>1 2 3 4</hello>
-1
-2
-3
-4
-<hello>2 4</hello>
-2
-4
-
-node=<elem key="<b>hello</b>"/>, key=Some(<b>hello</b>)
-node=<elem/>, key=None
-<a>Š</a>
diff --git a/test/files/jvm/xml03syntax.scala b/test/files/jvm/xml03syntax.scala
deleted file mode 100644
index 41663681c7..0000000000
--- a/test/files/jvm/xml03syntax.scala
+++ /dev/null
@@ -1,97 +0,0 @@
-import scala.xml._
-
-object Test {
-
- private def handle[A](x: Node): A = {
- println(x)
- x.child(0).asInstanceOf[Atom[A]].data
- }
-
- def main(args: Array[String]) {
- test1()
- test2()
- test3()
- }
-
- private def test1() {
- val xNull = <hello>{null}</hello> // these used to be Atom(unit), changed to empty children
-
- println(xNull.child sameElements Nil)
-
- val x0 = <hello>{}</hello> // these used to be Atom(unit), changed to empty children
- val x00 = <hello>{ }</hello> // dto.
-
- val xa = <hello>{ "world" }</hello>
-
-
- println(x0.child sameElements Nil)
- println(x00.child sameElements Nil)
- println(handle[String](xa) == "world")
-
- val xb = <hello>{ 1.5 }</hello>
-
- println(handle[Double](xb) == 1.5)
-
- val xc = <hello>{ 5 }</hello>
-
- println(handle[Int](xc) == 5)
-
- val xd = <hello>{ true }</hello>
-
- println(handle[Boolean](xd) == true)
-
- val xe = <hello>{ 5:Short }</hello>
-
- println(handle[Short](xe) == (5:Short))
-
- val xf = <hello>{ val x = 27; x }</hello>
-
- println(handle[Int](xf) == 27)
-
- val xg = <hello>{ List(1,2,3,4) }</hello>
-
- println(xg)
- for (z <- xg.child) {
- println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""})
- }
-
- val xh = <hello>{ for(x <- List(1,2,3,4) if x % 2 == 0) yield x }</hello>
-
- println(xh)
- for (z <- xh.child) {
- println(z.toString() + {if (z.isInstanceOf[Text]) "(is text node ' ')" else ""})
- }
- println
- }
-
- /** see SVN r13821 (emir): support for <elem key={x:Option[Seq[Node]]} />,
- * so that Options can be used for optional attributes.
- */
- private def test2() {
- val x1: Option[Seq[Node]] = Some(<b>hello</b>)
- val n1 = <elem key={x1} />;
- println("node="+n1+", key="+n1.attribute("key"))
-
- val x2: Option[Seq[Node]] = None
- val n2 = <elem key={x2} />;
- println("node="+n2+", key="+n2.attribute("key"))
- }
-
- private def test3() {
- // this demonstrates how to handle entities
- val s = io.Source.fromString("<a>&nbsp;</a>")
- object parser extends xml.parsing.ConstructingParser(s, false /*ignore ws*/) {
- override def replacementText(entityName: String): io.Source = {
- entityName match {
- case "nbsp" => io.Source.fromString("\u0160");
- case _ => super.replacementText(entityName);
- }
- }
- nextch; // !!important, to initialize the parser
- }
- val parsed = parser.element(TopScope) // parse the source as element
- // alternatively, we could call document()
- println(parsed)
- }
-
-}
diff --git a/test/files/jvm/xml04embed.check b/test/files/jvm/xml04embed.check
deleted file mode 100644
index e71e645149..0000000000
--- a/test/files/jvm/xml04embed.check
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-}
-{}{}{}
diff --git a/test/files/jvm/xml04embed.scala b/test/files/jvm/xml04embed.scala
deleted file mode 100644
index fa453e4295..0000000000
--- a/test/files/jvm/xml04embed.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-object Test {
- def main(args: Array[String]) {
- val ya = <x>{{</x>
- println(ya.text)
- val ua = <x>}}</x>
- println(ua.text)
- val za = <x>{{}}{{}}{{}}</x>
- println(za.text)
- }
-}
diff --git a/test/files/jvm/xmlattr.check b/test/files/jvm/xmlattr.check
deleted file mode 100644
index a87420d86c..0000000000
--- a/test/files/jvm/xmlattr.check
+++ /dev/null
@@ -1,18 +0,0 @@
-true
-true
-true
-true
-true
-true
-removal of duplicates for unprefixed attributes in append = 1
-true
-true
-true
-true
-true
-true
-true
-true
-true
-<b x="&amp;"/>
-<b x="&amp;"/>
diff --git a/test/files/jvm/xmlattr.scala b/test/files/jvm/xmlattr.scala
deleted file mode 100644
index 6423268ba7..0000000000
--- a/test/files/jvm/xmlattr.scala
+++ /dev/null
@@ -1,70 +0,0 @@
-import xml.{ NodeSeq, Null, Text, UnprefixedAttribute }
-
-object Test {
-
- def main(args: Array[String]) {
- UnprefixedAttributeTest()
- AttributeWithOptionTest()
- AttributeOutputTest()
- AttributeOperatorTest()
- }
-
- object UnprefixedAttributeTest {
- def apply() {
- val x = new UnprefixedAttribute("foo","bar", Null)
- println(Some(Text("bar")) == x.get("foo"))
- println(Text("bar") == x("foo"))
- println(None == x.get("no_foo"))
- println(null == x("no_foo"))
-
- val y = x.remove("foo")
- println(Null == y)
-
- val z = new UnprefixedAttribute("foo", null:NodeSeq, x)
- println(None == z.get("foo"))
-
- var appended = x append x append x append x
- var len = 0; while (appended ne Null) {
- appended = appended.next
- len = len + 1
- }
- println("removal of duplicates for unprefixed attributes in append = " + len)
- }
- }
-
- object AttributeWithOptionTest {
- def apply() {
- val x = new UnprefixedAttribute("foo", Some(Text("bar")), Null)
-
- println(Some(Text("bar")) == x.get("foo"))
- println(Text("bar") == x("foo"))
- println(None == x.get("no_foo"))
- println(null == x("no_foo"))
-
- val attr1 = Some(Text("foo value"))
- val attr2 = None
- val y = <b foo={attr1} bar={attr2} />
- println(Some(Text("foo value")) == y.attributes.get("foo"));
- println(Text("foo value") == y.attributes("foo"))
- println(None == y.attributes.get("bar"))
- println(null == y.attributes("bar"))
-
- val z = new UnprefixedAttribute("foo", None, x)
- println(None == z.get("foo"))
- }
- }
-
- object AttributeOutputTest {
- def apply() {
- println(<b x="&amp;"/>)
- println(<b x={"&"}/>)
- }
- }
-
- object AttributeOperatorTest {
- def apply() {
- val xml = <foo bar="apple" />
- assert(xml \@ "bar" == "apple")
- }
- }
-}
diff --git a/test/files/jvm/xmlmore.check b/test/files/jvm/xmlmore.check
deleted file mode 100644
index 29f144c89f..0000000000
--- a/test/files/jvm/xmlmore.check
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- thissa comment -->
-<?this is a pi foo bar = && {{ ?>
-
- &quot;Come, come again, whoever you are, come!
-Heathen, fire worshipper or idolatrous, come!
-Come even if you broke your penitence a hundred times,
-Ours is the portal of hope, come as you are.&quot;
- Mevlana Celaleddin Rumi
-<foo><br /></foo>
-End Test
diff --git a/test/files/jvm/xmlmore.scala b/test/files/jvm/xmlmore.scala
deleted file mode 100644
index 04d0a6c759..0000000000
--- a/test/files/jvm/xmlmore.scala
+++ /dev/null
@@ -1,29 +0,0 @@
-object myBreak extends scala.xml.Unparsed("<br />")
-
-object Test extends App {
- val com = <!-- thissa comment -->
- val pi = <?this is a pi foo bar = && {{ ?>
- val crz = <![CDATA[
- "Come, come again, whoever you are, come!
-Heathen, fire worshipper or idolatrous, come!
-Come even if you broke your penitence a hundred times,
-Ours is the portal of hope, come as you are."
- Mevlana Celaleddin Rumi]]>
-
- val nazim = <foo>{myBreak}</foo> // shows use of unparsed
-
- Console println com
- Console println pi
- Console println crz // this guy will escaped, and rightly so
- Console println nazim
- Console println "End Test"
-
- <x:foo xmlns:x="gaga"/> match {
- case scala.xml.QNode("gaga","foo",md,child@_*) =>
- }
-
- <x:foo xmlns:x="gaga"/> match {
- case scala.xml.Node("foo",md,child@_*) =>
- }
-
-}
diff --git a/test/files/jvm/xmlpull.scala b/test/files/jvm/xmlpull.scala
deleted file mode 100644
index 9ba7d4cf02..0000000000
--- a/test/files/jvm/xmlpull.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-import scala.xml._
-import scala.xml.pull._
-import scala.io.Source
-
-object Test {
-
- val src = Source.fromString("<hello><world/>!</hello>")
-
- def main(args: Array[String]) {
- var er = new XMLEventReader(src)
- er.next match {
- case EvElemStart(_, "hello", _, _) => //println("1")
- }
- er.next match {
- case EvElemStart(_, "world", _, _) => //println("2")
- }
- er.next match {
- case EvElemEnd(_, "world") => //println("3")
- }
- er.next match {
- case EvText("!") => //println("4")
- }
- er.next match {
- case EvElemEnd(_, "hello") => //println("5")
- }
- // you get the picture...
- er.stop // allow thread to be garbage-collected
- //println("6")
- }
-}
-
diff --git a/test/files/jvm/xmlstuff.check b/test/files/jvm/xmlstuff.check
deleted file mode 100644
index e1222479f7..0000000000
--- a/test/files/jvm/xmlstuff.check
+++ /dev/null
@@ -1,22 +0,0 @@
-NodeSeq
-<result>
- <title>Blabla</title>
- <remarks> Hallo Welt. </remarks>
-</result><result>
- <title>Blubabla</title>
- <remarks> Hello Blu </remarks>
-</result><result>
- <title>Blubabla</title>
- <remarks> rem 2 </remarks>
-</result>
-List(<book><title>Blabla</title></book>)
-<result>
- <name>John</name>
- <street> Elm Street</street>
- <city>Dolphin City</city>
- <phone where="work"> +41 21 693 68 67</phone>
- <phone where="mobile">+41 79 602 23 23</phone>
-</result>
-namespaces
-validation - elements
-validation - attributes
diff --git a/test/files/jvm/xmlstuff.scala b/test/files/jvm/xmlstuff.scala
deleted file mode 100644
index 45234c7139..0000000000
--- a/test/files/jvm/xmlstuff.scala
+++ /dev/null
@@ -1,181 +0,0 @@
-import java.io.StringReader
-import org.xml.sax.InputSource
-import scala.xml.{Node, NodeSeq, Elem, Text, XML}
-
-object Test {
-
- /** returns true if exception was thrown */
- def catcher(att: Function1[Unit, scala.xml.MetaData]): Boolean = {
- var ex = false
- try {
- att.apply({})
- } catch {
- case scala.xml.MalformedAttributeException(msg) =>
- println(msg)
- ex = true
- }
- ex
- }
-
- def main(args: Array[String]) {
-
- println("NodeSeq")
-
- val p = <foo>
- <bar gt='ga' value="3"/>
- <baz bazValue="8"/>
- <bar value="5" gi='go'/>
- </foo>;
-
- val pelems_1 = for (x <- p \ "bar"; y <- p \ "baz" ) yield {
- Text(x.attributes("value").toString + y.attributes("bazValue").toString+ "!")
- };
- val pelems_2 = new NodeSeq { val theSeq = List(Text("38!"),Text("58!")) };
- assert(pelems_1 sameElements pelems_2)
-
- assert(Text("8") sameElements (p \\ "@bazValue"))
-
- val books =
- <bks>
- <book><title>Blabla</title></book>
- <book><title>Blubabla</title></book>
- <book><title>Baaaaaaalabla</title></book>
- </bks>;
-
- val reviews =
- <reviews>
- <entry><title>Blabla</title>
- <remarks>
- Hallo Welt.
- </remarks>
- </entry>
- <entry><title>Blubabla</title>
- <remarks>
- Hello Blu
- </remarks>
- </entry>
- <entry><title>Blubabla</title>
- <remarks>
- rem 2
- </remarks>
- </entry>
- </reviews>;
-
- println( new scala.xml.PrettyPrinter(80, 5).formatNodes (
- for (t <- books \\ "title";
- r <- reviews \\ "entry"
- if (r \ "title") xml_== t) yield
- <result>
- { t }
- { r \ "remarks" }
- </result>
- ));
-
- // example
- println(
- for (t @ <book><title>Blabla</title></book> <- new NodeSeq { val theSeq = books.child }.toList)
- yield t
- );
- val phoneBook =
- <phonebook>
- <descr>
- This is the <b>phonebook</b> of the
- <a href="http://acme.org">ACME</a> corporation.
- </descr>
- <entry>
- <name>John</name>
- <phone where="work"> +41 21 693 68 67</phone>
- <phone where="mobile">+41 79 602 23 23</phone>
- </entry>
- </phonebook>;
-
-
- val addrBook =
- <addrbook>
- <descr>
- This is the <b>addressbook</b> of the
- <a href="http://acme.org">ACME</a> corporation.
- </descr>
- <entry>
- <name>John</name>
- <street> Elm Street</street>
- <city>Dolphin City</city>
- </entry>
- </addrbook>;
-
- println( new scala.xml.PrettyPrinter(80, 5).formatNodes (
- for (t <- addrBook \\ "entry";
- r <- phoneBook \\ "entry"
- if (t \ "name") xml_== (r \ "name")) yield
- <result>
- { t.child }
- { r \ "phone" }
- </result>
- ));
-
-
- /* namespaces */
- // begin tmp
- println("namespaces")
- val cuckoo = <cuckoo xmlns="http://cuckoo.com">
- <foo/>
- <bar/>
- </cuckoo>;
- assert(cuckoo.namespace == "http://cuckoo.com")
- for (n <- cuckoo \ "_" ) {
- //println("n = "+n);
- //println("n.prefix = "+n.prefix);
- //.println("n.scope = "+n.scope);
- assert( n.namespace == "http://cuckoo.com")
- }
-
- println("validation - elements")
- val vtor = new scala.xml.dtd.ElementValidator();
- {
- import scala.xml.dtd.ELEMENTS
- import scala.xml.dtd.ContentModel._
- vtor.setContentModel(
- ELEMENTS(
- Sequ(
- Letter(ElemName("bar")),
- Star(Letter(ElemName("baz"))) )));
-
- }
- assert(vtor( <foo><bar/><baz/><baz/></foo> ))
-
- {
- import scala.xml.dtd.MIXED
- import scala.xml.dtd.ContentModel._
-
- vtor.setContentModel(
- MIXED(
- Alt(Letter(ElemName("bar")),
- Letter(ElemName("baz")),
- Letter(ElemName("bal")))));
- }
-
- assert(vtor(<foo><bar/><baz/><baz/></foo> ))
- assert(vtor(<foo>ab<bar/>cd<baz/>ed<baz/>gh</foo> ))
- assert(!vtor(<foo> <ugha/> <bugha/> </foo> ))
-
- println("validation - attributes")
- vtor.setContentModel(null)
- vtor.setMetaData(List())
- assert(!vtor( <foo bar="hello"/> ))
-
- {
- import scala.xml.dtd._
- vtor setMetaData List(AttrDecl("bar", "CDATA", IMPLIED))
- }
- assert(!vtor(<foo href="http://foo.com" bar="hello"/>))
- assert(vtor(<foo bar="hello"/>))
-
- {
- import scala.xml.dtd._
- vtor.setMetaData(List(AttrDecl("bar","CDATA",REQUIRED)))
- }
- assert(!vtor( <foo href="http://foo.com" /> ))
- assert( vtor( <foo bar="http://foo.com" /> ))
-
- }
-}
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
index 5f9d0a1ccc..fd1e2728c3 100644
--- a/test/files/neg/classmanifests_new_deprecations.check
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -7,9 +7,6 @@ classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object P
classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
val cm3: ClassManifest[Int] = null
^
-classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
- val cm3: ClassManifest[Int] = null
- ^
classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
def rcm1[T: scala.reflect.ClassManifest] = ???
^
@@ -19,9 +16,6 @@ classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package
classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
val rcm3: scala.reflect.ClassManifest[Int] = null
^
-classmanifests_new_deprecations.scala:8: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
- val rcm3: scala.reflect.ClassManifest[Int] = null
- ^
classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead
type CM[T] = ClassManifest[T]
^
@@ -29,5 +23,5 @@ classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package
type RCM[T] = scala.reflect.ClassManifest[T]
^
error: No warnings can be incurred under -Xfatal-warnings.
-10 warnings found
+8 warnings found
one error found
diff --git a/test/files/neg/macro-abort.check b/test/files/neg/macro-abort.check
new file mode 100644
index 0000000000..1e58add533
--- /dev/null
+++ b/test/files/neg/macro-abort.check
@@ -0,0 +1,4 @@
+Test_2.scala:2: error: aborted
+ Macros.abort
+ ^
+one error found
diff --git a/test/files/neg/macro-abort/Macros_1.scala b/test/files/neg/macro-abort/Macros_1.scala
new file mode 100644
index 0000000000..676c112098
--- /dev/null
+++ b/test/files/neg/macro-abort/Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl(c: Context) = {
+ c.abort(c.enclosingPosition, "aborted")
+ }
+ def abort = macro impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-abort/Test_2.scala b/test/files/neg/macro-abort/Test_2.scala
new file mode 100644
index 0000000000..1d0a7a25dc
--- /dev/null
+++ b/test/files/neg/macro-abort/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.abort
+} \ No newline at end of file
diff --git a/test/files/neg/macro-exception.check b/test/files/neg/macro-exception.check
new file mode 100644
index 0000000000..cee8b32ebd
--- /dev/null
+++ b/test/files/neg/macro-exception.check
@@ -0,0 +1,7 @@
+Test_2.scala:2: error: exception during macro expansion:
+java.lang.Exception
+ at Macros$.impl(Macros_1.scala:6)
+
+ Macros.exception
+ ^
+one error found
diff --git a/test/files/neg/macro-exception/Macros_1.scala b/test/files/neg/macro-exception/Macros_1.scala
new file mode 100644
index 0000000000..60e4020aec
--- /dev/null
+++ b/test/files/neg/macro-exception/Macros_1.scala
@@ -0,0 +1,9 @@
+import scala.language.experimental.macros
+import scala.reflect.macros.Context
+
+object Macros {
+ def impl(c: Context) = {
+ throw new Exception()
+ }
+ def exception = macro impl
+} \ No newline at end of file
diff --git a/test/files/neg/macro-exception/Test_2.scala b/test/files/neg/macro-exception/Test_2.scala
new file mode 100644
index 0000000000..d82b21f2b2
--- /dev/null
+++ b/test/files/neg/macro-exception/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Macros.exception
+} \ No newline at end of file
diff --git a/test/files/neg/macro-invalidusage-presuper.check b/test/files/neg/macro-invalidusage-presuper.check
index f63a0eef80..c0b1ec0248 100644
--- a/test/files/neg/macro-invalidusage-presuper.check
+++ b/test/files/neg/macro-invalidusage-presuper.check
@@ -1,4 +1,4 @@
-Macros_Test_2.scala:3: error: only type definitions and concrete field definitions allowed in early object initialization section
+Macros_Test_2.scala:3: error: only concrete field definitions allowed in early object initialization section
class D extends { def x = macro impl } with AnyRef
^
one error found
diff --git a/test/files/neg/t1011.check b/test/files/neg/t1011.check
deleted file mode 100644
index d9c8123549..0000000000
--- a/test/files/neg/t1011.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t1011.scala:8: error: not found: value entity
- <dl><code>{Text(entity)}</code>
- ^
-one error found
diff --git a/test/files/neg/t1011.scala b/test/files/neg/t1011.scala
deleted file mode 100644
index 57a6ad7b45..0000000000
--- a/test/files/neg/t1011.scala
+++ /dev/null
@@ -1,127 +0,0 @@
-package test;
-import scala.xml._;
-
-abstract class Test {
- //val entity : String;
- def primitiveHeader : NodeSeq =
- Group({
- <dl><code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code>
- <code>{Text(entity)}</code></dl>
- } ++ // 3 seconds
- {}++ // 5 seconds
- {}++ // 10 seconds
- {}++ // 20 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 5 seconds
- {}++ // 10 seconds
- {}++ // 20 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 5 seconds
- {}++ // 10 seconds
- {}++ // 20 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- {}++ // 40 seconds
- <hr/>);
-}
diff --git a/test/files/neg/t1017.check b/test/files/neg/t1017.check
deleted file mode 100644
index 52101c7f6e..0000000000
--- a/test/files/neg/t1017.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t1017.scala:3: error: not found: value foo
-<x><x><x><x><x><x><x><x><x><x><x><x><x><x><x><x><x><x>{ foo }</x></x></x></x></x></x></x></x></x></x></x></x></x></x></x></x></x></x>
- ^
-one error found
diff --git a/test/files/neg/t1017.scala b/test/files/neg/t1017.scala
deleted file mode 100644
index e389f308c3..0000000000
--- a/test/files/neg/t1017.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-// 'foo' is not defined
-object Test {
-<x><x><x><x><x><x><x><x><x><x><x><x><x><x><x><x><x><x>{ foo }</x></x></x></x></x></x></x></x></x></x></x></x></x></x></x></x></x></x>
-}
diff --git a/test/files/neg/t1845.scala b/test/files/neg/t1845.scala
index dab448b7dd..4d3966484d 100644
--- a/test/files/neg/t1845.scala
+++ b/test/files/neg/t1845.scala
@@ -1,10 +1,10 @@
-import scala.util.parsing.combinator.syntactical.TokenParsers
-import scala.util.parsing.combinator.lexical.StdLexical
-import scala.util.parsing.combinator.token._
+class Tokens { abstract class Token }
+trait TokenParsers { val lexical: Tokens }
+
class MyTokenParsers extends TokenParsers {
import lexical._
- type Tokens = StdTokens
- type Elem = lexical.Token
- val lexical = new StdLexical
+
+
+ val lexical = new Tokens
}
diff --git a/test/files/neg/t1878-typer.check b/test/files/neg/t1878-typer.check
deleted file mode 100644
index e3a20d0be7..0000000000
--- a/test/files/neg/t1878-typer.check
+++ /dev/null
@@ -1,4 +0,0 @@
-t1878-typer.scala:4: error: _* may only come last
- case <p> { _* } </p> =>
- ^
-one error found
diff --git a/test/files/neg/t1878-typer.scala b/test/files/neg/t1878-typer.scala
deleted file mode 100644
index 1eb0cb7dff..0000000000
--- a/test/files/neg/t1878-typer.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- // illegal - bug #1764
- null match {
- case <p> { _* } </p> =>
- }
-}
diff --git a/test/files/neg/t2796.check b/test/files/neg/t2796.check
index 4456a7fc19..22ee35a7e6 100644
--- a/test/files/neg/t2796.check
+++ b/test/files/neg/t2796.check
@@ -1,6 +1,9 @@
+t2796.scala:11: warning: early type members are deprecated. Move them to the regular body: the semantics are the same.
+ type X = Int // warn
+ ^
t2796.scala:7: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized.
val abstractVal = "T1.abstractVal" // warn
^
error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
+two warnings found
one error found
diff --git a/test/files/neg/t2796.flags b/test/files/neg/t2796.flags
index e8fb65d50c..d1b831ea87 100644
--- a/test/files/neg/t2796.flags
+++ b/test/files/neg/t2796.flags
@@ -1 +1 @@
--Xfatal-warnings \ No newline at end of file
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t2796.scala b/test/files/neg/t2796.scala
index 3bcc9df562..fa2f2358b9 100644
--- a/test/files/neg/t2796.scala
+++ b/test/files/neg/t2796.scala
@@ -8,10 +8,9 @@ trait T1 extends {
} with Base
trait T2 extends {
- type X = Int // okay
+ type X = Int // warn
} with Base
-
class C1 extends {
val abstractVal = "C1.abstractVal" // okay
} with Base
diff --git a/test/files/neg/t3160ambiguous.check b/test/files/neg/t3160ambiguous.check
index e80d9a5461..73a0c6d5db 100644
--- a/test/files/neg/t3160ambiguous.check
+++ b/test/files/neg/t3160ambiguous.check
@@ -1,7 +1,7 @@
-t3160ambiguous.scala:8: error: reference to Node is ambiguous;
+t3160ambiguous.scala:8: error: reference to List is ambiguous;
it is imported twice in the same scope by
-import scala.xml._
+import scala.collection.immutable._
and import Bippy._
- def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible
+ def f(x: List[Any]): String = ??? // ambiguous, because Bippy.List is accessible
^
one error found
diff --git a/test/files/neg/t3160ambiguous.scala b/test/files/neg/t3160ambiguous.scala
index cb9759b79c..57745e60d8 100644
--- a/test/files/neg/t3160ambiguous.scala
+++ b/test/files/neg/t3160ambiguous.scala
@@ -1,15 +1,15 @@
object Bippy {
- private class Node
+ private class List[+T]
}
class Bippy {
import Bippy._
- import scala.xml._
+ import scala.collection.immutable._
- def f(x: Node): String = ??? // ambiguous, because Bippy.Node is accessible
+ def f(x: List[Any]): String = ??? // ambiguous, because Bippy.List is accessible
}
class Other {
import Bippy._
- import scala.xml._
+ import scala.collection.immutable._
- def f(x: Node): String = ??? // unambiguous, because Bippy.Node is inaccessible
+ def f(x: List[Any]): String = ??? // unambiguous, because Bippy.List is inaccessible
}
diff --git a/test/files/neg/t3776.scala b/test/files/neg/t3776.scala
index 454f914316..1075816511 100644
--- a/test/files/neg/t3776.scala
+++ b/test/files/neg/t3776.scala
@@ -1,8 +1,8 @@
-import util.parsing.combinator.{PackratParsers, RegexParsers}
-
-object MyParser extends RegexParsers with PackratParsers {
+object MyParser {
+ implicit def literal(s: String): Parser[String] = ???
+ trait Parser[+T]
+ def parse[T](p: Parser[T], in: java.lang.CharSequence): Option[T] = ???
}
-
object Test {
class ParsedAs(a: String) (implicit pattern: MyParser.Parser[_]) {
def parsedAs[T](v: T) = MyParser.parse(pattern, a).get someOperation v
diff --git a/test/files/neg/t7020.check b/test/files/neg/t7020.check
new file mode 100644
index 0000000000..f9600ca7fc
--- /dev/null
+++ b/test/files/neg/t7020.check
@@ -0,0 +1,19 @@
+t7020.scala:3: warning: match may not be exhaustive.
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+ List(5) match {
+ ^
+t7020.scala:10: warning: match may not be exhaustive.
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+ List(5) match {
+ ^
+t7020.scala:17: warning: match may not be exhaustive.
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+ List(5) match {
+ ^
+t7020.scala:24: warning: match may not be exhaustive.
+It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _)
+ List(5) match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+four warnings found
+one error found
diff --git a/test/files/neg/t7020.flags b/test/files/neg/t7020.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7020.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7020.scala b/test/files/neg/t7020.scala
new file mode 100644
index 0000000000..cc5421bab1
--- /dev/null
+++ b/test/files/neg/t7020.scala
@@ -0,0 +1,30 @@
+object Test {
+ // warning was non-deterministic
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+
+ List(5) match {
+ case 1 :: Nil | 2 :: Nil =>
+ case (x@(4 | 5 | 6)) :: Nil =>
+ case 7 :: Nil =>
+ case Nil =>
+ }
+}
diff --git a/test/files/neg/t7185.check b/test/files/neg/t7185.check
deleted file mode 100644
index 46f2cc797e..0000000000
--- a/test/files/neg/t7185.check
+++ /dev/null
@@ -1,7 +0,0 @@
-t7185.scala:2: error: overloaded method value apply with alternatives:
- (f: scala.xml.Node => Boolean)scala.xml.NodeSeq <and>
- (i: Int)scala.xml.Node
- cannot be applied to ()
- <e></e>()
- ^
-one error found
diff --git a/test/files/neg/t7185.scala b/test/files/neg/t7185.scala
deleted file mode 100644
index 2f9284bc5f..0000000000
--- a/test/files/neg/t7185.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test {
- <e></e>()
-}
diff --git a/test/files/neg/t7694b.check b/test/files/neg/t7694b.check
new file mode 100644
index 0000000000..ea3d7736f8
--- /dev/null
+++ b/test/files/neg/t7694b.check
@@ -0,0 +1,7 @@
+t7694b.scala:8: error: type arguments [_3,_4] do not conform to trait L's type parameter bounds [A2,B2 <: A2]
+ def d = if (true) (null: L[A, A]) else (null: L[B, B])
+ ^
+t7694b.scala:9: error: type arguments [_1,_2] do not conform to trait L's type parameter bounds [A2,B2 <: A2]
+ val v = if (true) (null: L[A, A]) else (null: L[B, B])
+ ^
+two errors found
diff --git a/test/files/neg/t7752.check b/test/files/neg/t7752.check
new file mode 100644
index 0000000000..0a015d3f37
--- /dev/null
+++ b/test/files/neg/t7752.check
@@ -0,0 +1,27 @@
+t7752.scala:25: error: overloaded method value foo with alternatives:
+ [A](heading: String, rows: A*)(A,) <and>
+ [A, B](heading: (String, String), rows: (A, B)*)(A, B) <and>
+ [A, B, C](heading: (String, String, String), rows: (A, B, C)*)(A, B, C) <and>
+ [A, B, C, D](heading: (String, String, String, String), rows: (A, B, C, D)*)(A, B, C, D) <and>
+ [A, B, C, D, E](heading: (String, String, String, String, String), rows: (A, B, C, D, E)*)(A, B, C, D, E) <and>
+ [A, B, C, D, E, F](heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*)(A, B, C, D, E, F) <and>
+ [A, B, C, D, E, F, G](heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*)(A, B, C, D, E, F, G) <and>
+ [A, B, C, D, E, F, G, H](heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*)(A, B, C, D, E, F, G, H) <and>
+ [A, B, C, D, E, F, G, H, I](heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*)(A, B, C, D, E, F, G, H, I) <and>
+ [A, B, C, D, E, F, G, H, I, J](heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*)(A, B, C, D, E, F, G, H, I, J) <and>
+ [A, B, C, D, E, F, G, H, I, J, K](heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*)(A, B, C, D, E, F, G, H, I, J, K) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L](heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*)(A, B, C, D, E, F, G, H, I, J, K, L) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*)(A, B, C, D, E, F, G, H, I, J, K, L, M) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) <and>
+ [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)
+ cannot be applied to (Int)
+ foo((1))
+ ^
+one error found
diff --git a/test/files/neg/t7752.scala b/test/files/neg/t7752.scala
new file mode 100644
index 0000000000..40ba2103b1
--- /dev/null
+++ b/test/files/neg/t7752.scala
@@ -0,0 +1,26 @@
+object Test {
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*): Tuple22[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*): Tuple21[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*): Tuple20[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*): Tuple19[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*): Tuple18[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*): Tuple17[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*): Tuple16[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*): Tuple15[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*): Tuple14[A,B,C,D,E,F,G,H,I,J,K,L,M,N] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L, M](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*): Tuple13[A,B,C,D,E,F,G,H,I,J,K,L,M] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K, L](heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*): Tuple12[A,B,C,D,E,F,G,H,I,J,K,L] = null
+ def foo[A, B, C, D, E, F, G, H, I, J, K](heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*): Tuple11[A,B,C,D,E,F,G,H,I,J,K] = null
+ def foo[A, B, C, D, E, F, G, H, I, J](heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*): Tuple10[A,B,C,D,E,F,G,H,I,J] = null
+ def foo[A, B, C, D, E, F, G, H, I](heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*): Tuple9[A,B,C,D,E,F,G,H,I] = null
+ def foo[A, B, C, D, E, F, G, H](heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*): Tuple8[A,B,C,D,E,F,G,H] = null
+ def foo[A, B, C, D, E, F, G](heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*): Tuple7[A,B,C,D,E,F,G] = null
+ def foo[A, B, C, D, E, F](heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*): Tuple6[A,B,C,D,E,F] = null
+ def foo[A, B, C, D, E](heading: (String, String, String, String, String), rows: (A, B, C, D, E)*): Tuple5[A,B,C,D,E] = null
+ def foo[A, B, C, D](heading: (String, String, String, String), rows: (A, B, C, D)*): Tuple4[A,B,C,D] = null
+ def foo[A, B, C](heading: (String, String, String), rows: (A, B, C)*): Tuple3[A,B,C] = null
+ def foo[A, B](heading: (String, String), rows: (A, B)*): Tuple2[A,B] = null
+ def foo[A](heading: String, rows: A*): Tuple1[A] = null
+
+ foo((1))
+} \ No newline at end of file
diff --git a/test/files/neg/t935.check b/test/files/neg/t935.check
index 8b73700187..af634a2630 100644
--- a/test/files/neg/t935.check
+++ b/test/files/neg/t935.check
@@ -4,7 +4,4 @@ t935.scala:7: error: type arguments [Test3.B] do not conform to class E's type p
t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String]
val b: String @E[B](new B) = "hi"
^
-t935.scala:13: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String]
- val b: String @E[B](new B) = "hi"
- ^
-three errors found
+two errors found
diff --git a/test/files/pos/matchStarlift.scala b/test/files/pos/matchStarlift.scala
deleted file mode 100644
index dab46eada2..0000000000
--- a/test/files/pos/matchStarlift.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-object Tet {
- import scala.xml._;
- def fooz(x: Node=>String) = {}
- def foo( m:Node ):Unit = fooz {
- case Elem(_,_,_,_,n,_*) if (n == m) => "gaga"
- }
-}
diff --git a/test/files/pos/t0422.scala b/test/files/pos/t0422.scala
deleted file mode 100644
index 2adfa392d2..0000000000
--- a/test/files/pos/t0422.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-package scala.xml.dtd.impl
-
-object BoolWordExp extends WordExp {
- type _labelT = MyLabels;
- type _regexpT = RegExp;
- abstract class MyLabels extends Label ;
- case class MyLabel(c:Char) extends MyLabels;
-}
-
-object MyTranslator extends WordBerrySethi {
- override val lang = BoolWordExp;
- import lang._;
- override protected def seenLabel( r:RegExp, i:Int, label: _labelT ): Unit = {
- super.seenLabel(r,i,label)
- }
-}
diff --git a/test/files/pos/t0646.scala b/test/files/pos/t0646.scala
deleted file mode 100644
index 6146e60020..0000000000
--- a/test/files/pos/t0646.scala
+++ /dev/null
@@ -1,21 +0,0 @@
-object xfor {
-
- import scala.xml.NodeSeq
-
- val books =
- <bks>
- <title>Blabla</title>
- <title>Blubabla</title>
- <title>Baaaaaaalabla</title>
- </bks>;
-
- new NodeSeq { val theSeq = books.child } match {
- case t @ Seq(<title>Blabla</title>) => t
- }
-
- //val n: NodeSeq = new NodeSeq { val theSeq = books.child }
- //n match {
- // case t @ <title>Blabla</title> => t
- //}
-
-}
diff --git a/test/files/pos/t1014.scala b/test/files/pos/t1014.scala
deleted file mode 100644
index 3fc10d10dc..0000000000
--- a/test/files/pos/t1014.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import scala.xml.{NodeSeq, Elem}
-
-class EO extends App with Moo {
- // return type is Flog, inherited from overridden method.
- // implicit conversions are applied because expected type `pt` is `Flog` when `computeType(rhs, pt)`.
- def cat = <cat>dog</cat>
-
- implicit def nodeSeqToFlog(in: Elem): Flog = new Flog(in)
-}
-
-trait Moo {
- def cat: Flog
-}
-
-class Flog(val in: NodeSeq)
diff --git a/test/files/pos/t1059.scala b/test/files/pos/t1059.scala
deleted file mode 100644
index bcd8f0374f..0000000000
--- a/test/files/pos/t1059.scala
+++ /dev/null
@@ -1,28 +0,0 @@
-package com;
-
-import scala.xml._
-
-object Main {
-
- def main(args : Array[String]) : Unit = {
-
- var m : PartialFunction[Any, Any] = {
-
- case SafeNodeSeq(s @ _*) => println(s) }
-
- println(m(<a/> ++ <b/>))
- println(m.isDefinedAt(<a/> ++ <b/>))
-
- }
-
-}
-
-object SafeNodeSeq {
-
- def unapplySeq(any: Any) : Option[Seq[Node]] = any match { case s: Seq[_] => Some(s flatMap ( _ match {
-
- case n: Node => n case _ => NodeSeq.Empty
-
- })) case _ => None }
-
-}
diff --git a/test/files/pos/t1203a.scala b/test/files/pos/t1203a.scala
deleted file mode 100644
index 062ef93fc6..0000000000
--- a/test/files/pos/t1203a.scala
+++ /dev/null
@@ -1,7 +0,0 @@
-case class ant(t: String) extends scala.annotation.Annotation
-object Test {
- def main(args: Array[String]): Unit = {
- val a: scala.xml.NodeSeq @ant("12") = Nil
- println(a)
- }
-}
diff --git a/test/files/pos/t1626.scala b/test/files/pos/t1626.scala
deleted file mode 100644
index 200be47430..0000000000
--- a/test/files/pos/t1626.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-object o {
- val n = <a xmlns=""/>
- n.namespace == null
-}
diff --git a/test/files/pos/t1761.scala b/test/files/pos/t1761.scala
deleted file mode 100644
index 2af7280734..0000000000
--- a/test/files/pos/t1761.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-import scala.xml._
-
-class Foo {
- val elements: Seq[Node] = Nil
- val innerTransform: PartialFunction[Elem, String] = {
- case Elem(_, l: String, _, _, _ @ _*) if elements.exists(_.label == l) =>
- l
- }
-}
-
diff --git a/test/files/pos/t2281.scala b/test/files/pos/t2281.scala
deleted file mode 100644
index 3515d2e2e6..0000000000
--- a/test/files/pos/t2281.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-import scala.collection.mutable.ArrayBuffer
-
-class A {
- def f(x: Boolean) = if (x) <br/><br/> else <br/>
-}
-
-class B {
- def splitSentences(text : String) : ArrayBuffer[String] = {
- val outarr = new ArrayBuffer[String]
- var outstr = new StringBuffer
- var prevspace = false
- val ctext = text.replaceAll("\n+","\n")
- ctext foreach {c =>
- outstr append c
- if(c == '.' || c == '!' || c == '?' || c == '\n' || c == ':' || c == ';' || (prevspace && c == '-') ){
- outarr += outstr.toString
- outstr = new StringBuffer
- }
- if(c == '\n'){
- outarr += "\n\n"
- }
- prevspace = c == ' '
- }
- if(outstr.length > 0){
- outarr += outstr.toString
- }
- outarr
- }
-
- def spanForSentence(x : String,picktext : String) =
- if(x == "\n\n"){
- <br/><br/>
- }else{
- <span class='clicksentence' style={if(x == picktext) "background-color: yellow" else ""}>{x}</span>
- }
-
- def selectableSentences(text : String, picktext : String) = {
- val sentences = splitSentences(text)
- sentences.map(x => spanForSentence(x,picktext))
- }
-} \ No newline at end of file
diff --git a/test/files/pos/t2698.scala b/test/files/pos/t2698.scala
deleted file mode 100644
index 7de50a13d6..0000000000
--- a/test/files/pos/t2698.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-package scala.xml.dtd.impl
-
-import scala.collection._
-
-abstract class S2 {
- val lang: WordExp
- type __labelT = lang._labelT
-
- var deltaq: Array[__labelT] = _
- def delta1 = immutable.Map(deltaq.zipWithIndex: _*)
-}
diff --git a/test/files/pos/t3160.scala b/test/files/pos/t3160.scala
deleted file mode 100644
index 3309ece160..0000000000
--- a/test/files/pos/t3160.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-import scala.collection.mutable._
-import scala.xml._
-
-class A {
- def f(x: Node): Node = ???
-}
diff --git a/test/files/pos/t4760.scala b/test/files/pos/t4760.scala
new file mode 100644
index 0000000000..767e3847f4
--- /dev/null
+++ b/test/files/pos/t4760.scala
@@ -0,0 +1,34 @@
+
+class Test {
+ // parses
+ def f1 = {
+ import scala._;
+ }
+ // b.scala:7: error: ';' expected but '}' found.
+ // }
+ // ^
+ // one error found
+ def f2 = {
+ import scala._
+ }
+ def f2b = {
+ import scala.collection.mutable.{ Map => MMap }
+ }
+ def f(): Unit = {
+ locally {
+ import scala.util.Properties.lineSeparator
+ }
+ }
+
+ // parses
+ def f3 = {
+ import scala._
+ 5
+ }
+ locally { (x: Int) =>
+ import scala.util._
+ }
+ 1 match {
+ case 1 => import scala.concurrent._
+ }
+}
diff --git a/test/files/pos/t5858.scala b/test/files/pos/t5858.scala
deleted file mode 100644
index f2b0f58d76..0000000000
--- a/test/files/pos/t5858.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test {
- new xml.Elem(null, null, xml.Null, xml.TopScope, Nil: _*) // was ambiguous
-}
diff --git a/test/files/pos/t6201.scala b/test/files/pos/t6201.scala
deleted file mode 100644
index 366c1f26eb..0000000000
--- a/test/files/pos/t6201.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-class Test {
- class Foo1 {
- def must(x: scala.xml.Elem) = ()
- }
-
- class Foo2 {
- def must(x: Int) = ()
- }
- implicit def toFoo1(s: scala.xml.Elem) = new Foo1()
- implicit def toFoo2(s: scala.xml.Elem) = new Foo2()
-
- def is: Unit = { (<a>{"a"}</a>).must(<a>{"b"}</a>) }
-} \ No newline at end of file
diff --git a/test/files/pos/t6897.scala b/test/files/pos/t6897.scala
deleted file mode 100644
index a7a03a1d3a..0000000000
--- a/test/files/pos/t6897.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-class A {
- val html = (null: Any) match {
- case 1 => <xml:group></xml:group>
- case 2 => <p></p>
- }
-}
diff --git a/test/files/pos/t7014/ThreadSafety.java b/test/files/pos/t7014/ThreadSafety.java
new file mode 100644
index 0000000000..ed508804e3
--- /dev/null
+++ b/test/files/pos/t7014/ThreadSafety.java
@@ -0,0 +1,9 @@
+package t7014;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse)
+public @interface ThreadSafety {
+ ThreadSafetyLevel level();
+} \ No newline at end of file
diff --git a/test/files/pos/t7014/ThreadSafetyLevel.java b/test/files/pos/t7014/ThreadSafetyLevel.java
new file mode 100644
index 0000000000..4df1dc787a
--- /dev/null
+++ b/test/files/pos/t7014/ThreadSafetyLevel.java
@@ -0,0 +1,8 @@
+package t7014; // package needed due to other bug in scalac's java parser
+
+// since we parse eagerly, we have not yet parsed the classfile when parsing the annotation,
+// and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference
+// from the annotation's argument to the enum's member
+// for now, let's just not crash -- should implement lazy completing at some point
+@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
+public enum ThreadSafetyLevel { COMPLETELY_THREADSAFE }
diff --git a/test/files/pos/t7014/t7014.scala b/test/files/pos/t7014/t7014.scala
new file mode 100644
index 0000000000..faec4c7740
--- /dev/null
+++ b/test/files/pos/t7014/t7014.scala
@@ -0,0 +1,4 @@
+package t7014
+
+import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed
+ \ No newline at end of file
diff --git a/test/files/pos/t715/meredith_1.scala b/test/files/pos/t715/meredith_1.scala
deleted file mode 100644
index c28afb4a9b..0000000000
--- a/test/files/pos/t715/meredith_1.scala
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.sap.dspace.model.othello;
-
-import scala.xml._
-
-trait XMLRenderer {
- type T <: Any {def getClass(): java.lang.Class[_]}
- val valueTypes =
- List(
- classOf[java.lang.Boolean],
- classOf[java.lang.Integer],
- classOf[java.lang.Float],
- classOf[java.lang.String]
- // more to come
- )
-
- def value2XML(
- value: Object,
- field: java.lang.reflect.Field,
- pojo: T
- ): Node = {
- value match {
- case null => Text("null")
- case vUnmatched =>
- if (value.isInstanceOf[java.lang.Boolean])
- Text(value.asInstanceOf[java.lang.Boolean].toString)
- else if (value.isInstanceOf[java.lang.Integer])
- Text(value.asInstanceOf[java.lang.Integer].toString)
- else if (value.isInstanceOf[java.lang.Float])
- Text(value.asInstanceOf[java.lang.Float].toString)
- // else if (value.isInstanceOf[T])
- // pojo2XML(value.asInstanceOf[T])
- else
- <unmatchedType>
- <theType>
- {vUnmatched.getClass.toString}
- </theType>
- <theValue>
- {vUnmatched.toString}
- </theValue>
- </unmatchedType>
- }
- }
-
- def field2XML(
- field: java.lang.reflect.Field,
- pojo: T
- ): Elem = {
-
- val accessible = field.isAccessible
- field.setAccessible(true)
- // BUGBUG lgm need to disambiguate on type and possibly make
- // recursive call to pojo2XML
- val fldValXML = value2XML(field.get( pojo ), field, pojo)
- field.setAccessible( accessible )
-
- Elem(
- null,
- field.getName,
- null,
- TopScope,
- fldValXML
- )
- }
-
- def pojo2XML(pojo: T): Elem = {
- val progeny =
- for (field <- pojo.getClass.getDeclaredFields)
- yield field2XML(field, pojo)
-
- Elem(
- null,
- pojo.getClass.getName,
- null,
- TopScope,
- progeny.asInstanceOf[Array[scala.xml.Node]]: _*
- )
- }
-}
-
-case class POJO2XMLRenderer(recurse: Boolean)
- extends XMLRenderer {
- type T = java.io.Serializable
- override def value2XML(
- value: Object,
- field: java.lang.reflect.Field,
- pojo: java.io.Serializable
- ): Node = {
- if (recurse) super.value2XML(value, field, pojo)
- else Text(value + "")
- }
-}
-
-object thePOJO2XMLRenderer extends POJO2XMLRenderer(true) {
-}
-
-object Test extends App {
- println(com.sap.dspace.model.othello.thePOJO2XMLRenderer)
-}
diff --git a/test/files/pos/t715/runner_2.scala b/test/files/pos/t715/runner_2.scala
deleted file mode 100644
index d54805629a..0000000000
--- a/test/files/pos/t715/runner_2.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test extends App {
- println(com.sap.dspace.model.othello.thePOJO2XMLRenderer)
-}
diff --git a/test/files/pos/t7486-named.scala b/test/files/pos/t7486-named.scala
new file mode 100644
index 0000000000..253293e5f1
--- /dev/null
+++ b/test/files/pos/t7486-named.scala
@@ -0,0 +1,8 @@
+
+object Test {
+ def fold(empty: Any) = ()
+ implicit val notAnnotatedImplicit = new {
+ fold(empty = 0)
+ def empty[A]: Any = ???
+ }
+}
diff --git a/test/pending/pos/t7486.scala b/test/files/pos/t7486.scala
index 6dd7f4c4ac..6dd7f4c4ac 100644
--- a/test/pending/pos/t7486.scala
+++ b/test/files/pos/t7486.scala
diff --git a/test/files/pos/t7694.scala b/test/files/pos/t7694.scala
new file mode 100644
index 0000000000..9852d5ec79
--- /dev/null
+++ b/test/files/pos/t7694.scala
@@ -0,0 +1,40 @@
+trait A
+trait B
+
+trait L[A2, B2 <: A2] {
+ def bar(a: Any, b: Any) = 0
+}
+
+object Lub {
+ // use named args transforms to include TypeTree(<lub.tpe>) in the AST before refchecks.
+ def foo(a: L[_, _], b: Any) = 0
+
+ foo(b = 0, a = if (true) (null: L[A, A]) else (null: L[B, B]))
+
+ (if (true) (null: L[A, A]) else (null: L[B, B])).bar(b = 0, a = 0)
+}
+
+/*
+The LUB ends up as:
+
+TypeRef(
+ TypeSymbol(
+ abstract trait L#7038[A2#7039, B2#7040 <: A2#7039] extends AnyRef#2197
+
+ )
+ args = List(
+ AbstractTypeRef(
+ AbstractType(
+ type _1#13680 >: A#7036 with B#7037 <: Object#1752
+ )
+ )
+ AbstractTypeRef(
+ AbstractType(
+ type _2#13681 >: A#7036 with B#7037 <: Object#1752
+ )
+ )
+ )
+)
+
+Note that type _2#13681 is *not* bound by _1#13680
+*/
diff --git a/test/files/pos/t7716.scala b/test/files/pos/t7716.scala
new file mode 100644
index 0000000000..40117051ed
--- /dev/null
+++ b/test/files/pos/t7716.scala
@@ -0,0 +1,16 @@
+object Test {
+ def test: Unit = {
+ val e: java.lang.Enum[_] = java.util.concurrent.TimeUnit.SECONDS
+ e match { case x => println(x) }
+
+
+ trait TA[X <: CharSequence]
+ val ta: TA[_] = new TA[String] {}
+
+ ta match {
+ case _ => println("hi")
+ }
+
+ def f(ta: TA[_]) = ta match { case _ => "hi" }
+ }
+}
diff --git a/test/files/pos/t7782.scala b/test/files/pos/t7782.scala
new file mode 100644
index 0000000000..037bdad673
--- /dev/null
+++ b/test/files/pos/t7782.scala
@@ -0,0 +1,25 @@
+package pack
+
+object Test {
+ import O.empty
+ empty // this will trigger completion of `test`
+ // with skolemizationLevel = 1
+}
+
+object O {
+ // order matters (!!!)
+
+ // this order breaks under 2.10.x
+ def empty[E]: C[E] = ???
+ def empty(implicit a: Any): Any = ???
+}
+
+abstract class C[E] {
+ def foo[BB](f: BB)
+ def test[B](f: B): Any = foo(f)
+ // error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : B&1
+ // required: ?BB
+}
diff --git a/test/files/pos/t7782b.scala b/test/files/pos/t7782b.scala
new file mode 100644
index 0000000000..09da4a5c5b
--- /dev/null
+++ b/test/files/pos/t7782b.scala
@@ -0,0 +1,25 @@
+package pack
+
+object Test {
+ import O.empty
+ empty // this will trigger completion of `test`
+ // with skolemizationLevel = 1
+}
+
+object O {
+ // order matters (!!!)
+
+ // this order breaks under 2.11.x
+ def empty(implicit a: Any): Any = ???
+ def empty[E]: C[E] = ???
+}
+
+abstract class C[E] {
+ def foo[BB](f: BB)
+ def test[B](f: B): Any = foo(f)
+ // error: no type parameters for method foo: (<param> f: BB)scala.this.Unit exist so that it can be applied to arguments (B&1)
+ // --- because ---
+ // argument expression's type is not compatible with formal parameter type;
+ // found : B&1
+ // required: ?BB
+}
diff --git a/test/files/pos/t880.scala b/test/files/pos/t880.scala
deleted file mode 100644
index cceb53c398..0000000000
--- a/test/files/pos/t880.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-import scala.xml.Null
-
-class Test[A >: Null]
-{
- val x : A = null
-}
diff --git a/test/files/pos/t942/Amount_1.java b/test/files/pos/t942/Amount_1.java
new file mode 100644
index 0000000000..d9d37d127b
--- /dev/null
+++ b/test/files/pos/t942/Amount_1.java
@@ -0,0 +1,5 @@
+import java.util.concurrent.Callable;
+
+public abstract class Amount_1<Q> extends Object
+ implements Callable<Amount_1<?>> {
+}
diff --git a/test/files/pos/t942/Test_2.scala b/test/files/pos/t942/Test_2.scala
new file mode 100644
index 0000000000..3cc84dae3c
--- /dev/null
+++ b/test/files/pos/t942/Test_2.scala
@@ -0,0 +1,3 @@
+abstract class Foo {
+ val x: Amount_1[Foo]
+}
diff --git a/test/files/presentation/partial-fun.check b/test/files/presentation/partial-fun.check
new file mode 100644
index 0000000000..0352d5e5c8
--- /dev/null
+++ b/test/files/presentation/partial-fun.check
@@ -0,0 +1,2 @@
+reload: PartialFun.scala
+ArrayBuffer()
diff --git a/test/files/presentation/partial-fun/Runner.scala b/test/files/presentation/partial-fun/Runner.scala
new file mode 100644
index 0000000000..3edd5bb5b0
--- /dev/null
+++ b/test/files/presentation/partial-fun/Runner.scala
@@ -0,0 +1,10 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest {
+ override def runDefaultTests() {
+ sourceFiles foreach (src => askLoadedTyped(src).get)
+ super.runDefaultTests()
+
+ println(compiler.unitOfFile.values.map(_.problems).mkString("", "\n", ""))
+ }
+}
diff --git a/test/files/presentation/partial-fun/partial-fun.check b/test/files/presentation/partial-fun/partial-fun.check
new file mode 100644
index 0000000000..adceab8280
--- /dev/null
+++ b/test/files/presentation/partial-fun/partial-fun.check
@@ -0,0 +1 @@
+reload: PartialFun.scala
diff --git a/test/files/presentation/partial-fun/src/PartialFun.scala b/test/files/presentation/partial-fun/src/PartialFun.scala
new file mode 100644
index 0000000000..4657898ed1
--- /dev/null
+++ b/test/files/presentation/partial-fun/src/PartialFun.scala
@@ -0,0 +1,5 @@
+class A {
+ def foo {
+ val x: PartialFunction[Int, Int] = ({ case 0 => 0 })
+ }
+}
diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala
new file mode 100644
index 0000000000..3c8f380150
--- /dev/null
+++ b/test/files/run/WeakHashSetTest.scala
@@ -0,0 +1,174 @@
+object Test {
+ def main(args: Array[String]) {
+ val test = scala.reflect.internal.util.WeakHashSetTest
+ test.checkEmpty
+ test.checkPlusEquals
+ test.checkPlusEqualsCollisions
+ test.checkRehashing
+ test.checkRehashCollisions
+ test.checkFindOrUpdate
+ test.checkMinusEquals
+ test.checkMinusEqualsCollisions
+ test.checkClear
+ test.checkIterator
+ test.checkIteratorCollisions
+
+ // This test is commented out because it relies on gc behavior which isn't reliable enough in an automated environment
+ // test.checkRemoveUnreferencedObjects
+ }
+}
+
+// put the main test object in the same package as WeakHashSet because
+// it uses the package private "diagnostics" method
+package scala.reflect.internal.util {
+
+ object WeakHashSetTest {
+ // a class guaranteed to provide hash collisions
+ case class Collider(x : String) extends Comparable[Collider] with Serializable {
+ override def hashCode = 0
+ def compareTo(y : Collider) = this.x compareTo y.x
+ }
+
+ // basic emptiness check
+ def checkEmpty {
+ val hs = new WeakHashSet[String]()
+ assert(hs.size == 0)
+ hs.diagnostics.fullyValidate
+ }
+
+ // make sure += works
+ def checkPlusEquals {
+ val hs = new WeakHashSet[String]()
+ val elements = List("hello", "goodbye")
+ elements foreach (hs += _)
+ assert(hs.size == 2)
+ assert(hs contains "hello")
+ assert(hs contains "goodbye")
+ hs.diagnostics.fullyValidate
+ }
+
+ // make sure += works when there are collisions
+ def checkPlusEqualsCollisions {
+ val hs = new WeakHashSet[Collider]()
+ val elements = List("hello", "goodbye") map Collider
+ elements foreach (hs += _)
+ assert(hs.size == 2)
+ assert(hs contains Collider("hello"))
+ assert(hs contains Collider("goodbye"))
+ hs.diagnostics.fullyValidate
+ }
+
+ // add a large number of elements to force rehashing and then validate
+ def checkRehashing {
+ val size = 200
+ val hs = new WeakHashSet[String]()
+ val elements = (0 until size).toList map ("a" + _)
+ elements foreach (hs += _)
+ elements foreach {i => assert(hs contains i)}
+ hs.diagnostics.fullyValidate
+ }
+
+ // make sure rehashing works properly when the set is rehashed
+ def checkRehashCollisions {
+ val size = 200
+ val hs = new WeakHashSet[Collider]()
+ val elements = (0 until size).toList map {x => Collider("a" + x)}
+ elements foreach (hs += _)
+ elements foreach {i => assert(hs contains i)}
+ hs.diagnostics.fullyValidate
+ }
+
+ // test that unreferenced objects are removed
+ // not run in an automated environment because gc behavior can't be relied on
+ def checkRemoveUnreferencedObjects {
+ val size = 200
+ val hs = new WeakHashSet[Collider]()
+ val elements = (0 until size).toList map {x => Collider("a" + x)}
+ elements foreach (hs += _)
+ // don't throw the following into a retained collection so gc
+ // can remove them
+ for (i <- 0 until size) {
+ hs += Collider("b" + i)
+ }
+ System.gc()
+ Thread.sleep(1000)
+ assert(hs.size == 200)
+ elements foreach {i => assert(hs contains i)}
+ for (i <- 0 until size) {
+ assert(!(hs contains Collider("b" + i)))
+ }
+ hs.diagnostics.fullyValidate
+ }
+
+ // make sure findOrUpdate returns the originally entered element
+ def checkFindOrUpdate {
+ val size = 200
+ val hs = new WeakHashSet[Collider]()
+ val elements = (0 until size).toList map {x => Collider("a" + x)}
+ elements foreach {x => assert(hs findEntryOrUpdate x eq x)}
+ for (i <- 0 until size) {
+ // when we do a lookup the result should be the same reference we
+ // original put in
+ assert(hs findEntryOrUpdate(Collider("a" + i)) eq elements(i))
+ }
+ hs.diagnostics.fullyValidate
+ }
+
+ // check -= functionality
+ def checkMinusEquals {
+ val hs = new WeakHashSet[String]()
+ val elements = List("hello", "goodbye")
+ elements foreach (hs += _)
+ hs -= "goodbye"
+ assert(hs.size == 1)
+ assert(hs contains "hello")
+ assert(!(hs contains "goodbye"))
+ hs.diagnostics.fullyValidate
+ }
+
+ // check -= when there are collisions
+ def checkMinusEqualsCollisions {
+ val hs = new WeakHashSet[Collider]
+ val elements = List(Collider("hello"), Collider("goodbye"))
+ elements foreach (hs += _)
+ hs -= Collider("goodbye")
+ assert(hs.size == 1)
+ assert(hs contains Collider("hello"))
+ assert(!(hs contains Collider("goodbye")))
+ hs -= Collider("hello")
+ assert(hs.size == 0)
+ assert(!(hs contains Collider("hello")))
+ hs.diagnostics.fullyValidate
+ }
+
+ // check that the clear method actually cleans everything
+ def checkClear {
+ val size = 200
+ val hs = new WeakHashSet[String]()
+ val elements = (0 until size).toList map ("a" + _)
+ elements foreach (hs += _)
+ hs.clear()
+ assert(hs.size == 0)
+ elements foreach {i => assert(!(hs contains i))}
+ hs.diagnostics.fullyValidate
+ }
+
+ // check that the iterator covers all the contents
+ def checkIterator {
+ val hs = new WeakHashSet[String]()
+ val elements = (0 until 20).toList map ("a" + _)
+ elements foreach (hs += _)
+ assert(elements.iterator.toList.sorted == elements.sorted)
+ hs.diagnostics.fullyValidate
+ }
+
+ // check that the iterator covers all the contents even when there is a collision
+ def checkIteratorCollisions {
+ val hs = new WeakHashSet[Collider]
+ val elements = (0 until 20).toList map {x => Collider("a" + x)}
+ elements foreach (hs += _)
+ assert(elements.iterator.toList.sorted == elements.sorted)
+ hs.diagnostics.fullyValidate
+ }
+ }
+}
diff --git a/test/files/run/analyzerPlugins.scala b/test/files/run/analyzerPlugins.scala
index b20a734fe6..4b297ff220 100644
--- a/test/files/run/analyzerPlugins.scala
+++ b/test/files/run/analyzerPlugins.scala
@@ -8,7 +8,9 @@ object Test extends DirectTest {
def code = """
class testAnn extends annotation.TypeConstraint
- class A(param: Double) extends { val x: Int = 1; val y = "two"; type T = A } with AnyRef {
+ class A(param: Double) extends { val x: Int = 1; val y = "two" } with AnyRef {
+ type T = A
+
val inferField = ("str": @testAnn)
val annotField: Boolean @testAnn = false
@@ -81,7 +83,7 @@ object Test extends DirectTest {
output += s"pluginsPt($pt, ${treeClass(tree)})"
pt
}
-
+
override def pluginsTyped(tpe: Type, typer: Typer, tree: Tree, mode: Mode, pt: Type): Type = {
output += s"pluginsTyped($tpe, ${treeClass(tree)})"
tpe
diff --git a/test/files/run/deprecate-early-type-defs.check b/test/files/run/deprecate-early-type-defs.check
new file mode 100644
index 0000000000..1ee01df13e
--- /dev/null
+++ b/test/files/run/deprecate-early-type-defs.check
@@ -0,0 +1,3 @@
+deprecate-early-type-defs.scala:1: warning: early type members are deprecated. Move them to the regular body: the semantics are the same.
+object Test extends { type T = Int } with App
+ ^
diff --git a/test/files/run/deprecate-early-type-defs.flags b/test/files/run/deprecate-early-type-defs.flags
new file mode 100644
index 0000000000..c36e713ab8
--- /dev/null
+++ b/test/files/run/deprecate-early-type-defs.flags
@@ -0,0 +1 @@
+-deprecation \ No newline at end of file
diff --git a/test/files/run/deprecate-early-type-defs.scala b/test/files/run/deprecate-early-type-defs.scala
new file mode 100644
index 0000000000..99e42166f2
--- /dev/null
+++ b/test/files/run/deprecate-early-type-defs.scala
@@ -0,0 +1 @@
+object Test extends { type T = Int } with App \ No newline at end of file
diff --git a/test/files/run/existential-rangepos.check b/test/files/run/existential-rangepos.check
new file mode 100644
index 0000000000..1212b60bae
--- /dev/null
+++ b/test/files/run/existential-rangepos.check
@@ -0,0 +1,13 @@
+[[syntax trees at end of patmat]] // newSource1.scala
+[0:76]package [0:0]<empty> {
+ [0:76]abstract class A[[17:18]T[17:18]] extends [20:76][76]scala.AnyRef {
+ [76]def <init>(): [20]A[T] = [76]{
+ [76][76][76]A.super.<init>();
+ [20]()
+ };
+ [24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null;
+ [28]<stable> <accessor> def foo: [28]Set[_ <: T] = [28][28]A.this.foo;
+ [54:74]<stable> <accessor> def bar: [58]Set[_ <: T]
+ }
+}
+
diff --git a/test/files/run/existential-rangepos.scala b/test/files/run/existential-rangepos.scala
new file mode 100644
index 0000000000..7d2b0810d3
--- /dev/null
+++ b/test/files/run/existential-rangepos.scala
@@ -0,0 +1,13 @@
+import scala.tools.partest._
+
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -Yrangepos -Xprint:patmat -Xprint-pos -d " + testOutput.path
+
+ override def code = """
+abstract class A[T] {
+ val foo: Set[_ <: T] = null
+ val bar: Set[_ <: T]
+}""".trim
+
+ override def show(): Unit = Console.withErr(System.out)(compile())
+}
diff --git a/test/files/run/fors.check b/test/files/run/fors.check
deleted file mode 100644
index 08ecc8ed5f..0000000000
--- a/test/files/run/fors.check
+++ /dev/null
@@ -1,46 +0,0 @@
-
-testOld
-1 2 3
-2
-2
-3
-1 2 3
-1 2 3
-0 1 2 3 4 5 6 7 8 9
-0 2 4 6 8
-0 2 4 6 8
-a b c
-b c
-b c
-
-
-<head><title>Scala</title></head>
-
-
-<body>1 2 3</body>
-
-
-<head><title>Scala</title></head>
-
-testNew
-3
-1 2 3
-1 2 3
-0 1 2 3 4 5 6 7 8 9
-0 2 4 6 8
-0 2 4 6 8
-0 2 4 6 8
-0 2 4 6 8
-0 2 4 6 8
-0 2 4 6 8
-0 2 4 6 8
-a b c
-
-
-<head><title>Scala</title></head>
-
-
-<body>1 2 3</body>
-
-
-<head><title>Scala</title></head>
diff --git a/test/files/run/fors.scala b/test/files/run/fors.scala
deleted file mode 100644
index 54afdc710b..0000000000
--- a/test/files/run/fors.scala
+++ /dev/null
@@ -1,97 +0,0 @@
-//############################################################################
-// for-comprehensions (old and new syntax)
-//############################################################################
-
-//############################################################################
-
-object Test extends App {
- val xs = List(1, 2, 3)
- val ys = List('a, 'b, 'c)
-
- def it = 0 until 10
-
- val ar = "abc".toCharArray
-
- val xml =
- <html>
- <head><title>Scala</title></head>
- <body>{xs}</body>
- </html>;
-
- /////////////////// old syntax ///////////////////
-
- def testOld {
- println("\ntestOld")
-
- // lists
- for (x <- xs) print(x + " "); println
- for (x <- xs;
- if x % 2 == 0) print(x + " "); println
- for {x <- xs
- if x % 2 == 0} print(x + " "); println
- var n = 0
- for (_ <- xs) n += 1; println(n)
- for ((x, y) <- xs zip ys) print(x + " "); println
- for (p @ (x, y) <- xs zip ys) print(p._1 + " "); println
-
- // iterators
- for (x <- it) print(x + " "); println
- for (x <- it;
- if x % 2 == 0) print(x + " "); println
- for {x <- it
- if x % 2 == 0} print(x + " "); println
-
- // arrays
- for (x <- ar) print(x + " "); println
- for (x <- ar;
- if x.toInt > 97) print(x + " "); println
- for {x <- ar
- if x.toInt > 97} print(x + " "); println
-
- // sequences
- for (x <- xml.child) println(x)
- for (x <- xml.child;
- if x.label == "head") println(x)
- }
-
- /////////////////// new syntax ///////////////////
-
- def testNew {
- println("\ntestNew")
-
- // lists
- var n = 0
- for (_ <- xs) n += 1; println(n)
- for ((x, y) <- xs zip ys) print(x + " "); println
- for (p @ (x, y) <- xs zip ys) print(p._1 + " "); println
-
- // iterators
- for (x <- it) print(x + " "); println
- for (x <- it if x % 2 == 0) print(x + " "); println
- for (x <- it; if x % 2 == 0) print(x + " "); println
- for (x <- it;
- if x % 2 == 0) print(x + " "); println
- for (x <- it
- if x % 2 == 0) print(x + " "); println
- for {x <- it
- if x % 2 == 0} print(x + " "); println
- for (x <- it;
- y = 2
- if x % y == 0) print(x + " "); println
- for {x <- it
- y = 2
- if x % y == 0} print(x + " "); println
-
- // arrays
- for (x <- ar) print(x + " "); println
-
- // sequences
- for (x <- xml.child) println(x)
- for (x <- xml.child if x.label == "head") println(x)
- }
-
- ////////////////////////////////////////////////////
-
- testOld
- testNew
-}
diff --git a/test/files/run/io-position.check b/test/files/run/io-position.check
deleted file mode 100644
index 09f743d750..0000000000
--- a/test/files/run/io-position.check
+++ /dev/null
Binary files differ
diff --git a/test/files/run/io-position.scala b/test/files/run/io-position.scala
deleted file mode 100644
index b227846fb4..0000000000
--- a/test/files/run/io-position.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test {
- def main(args: Array[String]): Unit = Console.withErr(Console.out) {
- try {
- xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<foo>"), false).document()
- } catch {
- case e:Exception => println(e.getMessage)
- }
- }
-
-}
-
diff --git a/test/files/run/json.check b/test/files/run/json.check
deleted file mode 100644
index d4d2b41658..0000000000
--- a/test/files/run/json.check
+++ /dev/null
@@ -1,21 +0,0 @@
-Passed compare: {"name" : "value"}
-Passed compare: {"name" : "va1ue"}
-Passed compare: {"name" : {"name1" : "va1ue1", "name2" : "va1ue2"}}
-Passed parse : {"name" : "\""}
-Passed compare: Map(function -> add_symbol)
-Passed compare: [{"a" : "team"}, {"b" : 52.0}]
-Passed compare: Map()
-Passed compare: List()
-Passed compare: [4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]
-Passed parse : {"age" : 0.0}
-Passed compare: {"name" : "va1ue"}
-Passed compare: {"name" : {"name1" : "va1ue1", "name2" : "va1ue2"}}
-Passed compare: [4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]
-Passed compare: {"\u006e\u0061\u006d\u0065" : "\u0076\u0061\u006c"}
-
-Passed compare: Map(firstName -> John, lastName -> Smith, address -> Map(streetAddress -> 21 2nd Street, city -> New York, state -> NY, postalCode -> 10021.0), phoneNumbers -> List(212 732-1234, 646 123-4567))
-
-Passed parse : {"addresses" : [{"format" : "us", "type" : "work", "value" : "1234 Main StnSpringfield, TX 78080-1216"}, {"format" : "us", "type" : "home", "value" : "5678 Main StnSpringfield, TX 78080-1316"}], "emailaddrs" : [{"type" : "work", "value" : "kelly@seankelly.biz"}, {"pref" : 1.0, "type" : "home", "value" : "kelly@seankelly.tv"}], "fullname" : "Sean Kelly", "org" : "SK Consulting", "telephones" : [{"pref" : 1.0, "type" : "work", "value" : "+1 214 555 1212"}, {"type" : "fax", "value" : "+1 214 555 1213"}, {"type" : "mobile", "value" : "+1 214 555 1214"}], "urls" : [{"type" : "work", "value" : "http:\/\/seankelly.biz\/"}, {"type" : "home", "value" : "http:\/\/seankelly.tv\/"}]}
-
-Passed parse : {"web-app" : {"servlet" : [{"init-param" : {"cachePackageTagsRefresh" : 60.0, "cachePackageTagsStore" : 200.0, "cachePackageTagsTrack" : 200.0, "cachePagesDirtyRead" : 10.0, "cachePagesRefresh" : 10.0, "cachePagesStore" : 100.0, "cachePagesTrack" : 200.0, "cacheTemplatesRefresh" : 15.0, "cacheTemplatesStore" : 50.0, "cacheTemplatesTrack" : 100.0, "configGlossary:adminEmail" : "ksm@pobox.com", "configGlossary:installationAt" : "Philadelphia, PA", "configGlossary:poweredBy" : "Cofax", "configGlossary:poweredByIcon" : "\/images\/cofax.gif", "configGlossary:staticPath" : "\/content\/static", "dataStoreClass" : "org.cofax.SqlDataStore", "dataStoreConnUsageLimit" : 100.0, "dataStoreDriver" : "com.microsoft.jdbc.sqlserver.SQLServerDriver", "dataStoreInitConns" : 10.0, "dataStoreLogFile" : "\/usr\/local\/tomcat\/logs\/datastore.log", "dataStoreLogLevel" : "debug", "dataStoreMaxConns" : 100.0, "dataStoreName" : "cofax", "dataStorePassword" : "dataStoreTestQuery", "dataStoreTestQuery" : "SET NOCOUNT ON;select test='test';", "dataStoreUrl" : "jdbc:microsoft:sqlserver:\/\/LOCALHOST:1433;DatabaseName=goon", "dataStoreUser" : "sa", "defaultFileTemplate" : "articleTemplate.htm", "defaultListTemplate" : "listTemplate.htm", "jspFileTemplate" : "articleTemplate.jsp", "jspListTemplate" : "listTemplate.jsp", "maxUrlLength" : 500.0, "redirectionClass" : "org.cofax.SqlRedirection", "searchEngineFileTemplate" : "forSearchEngines.htm", "searchEngineListTemplate" : "forSearchEnginesList.htm", "searchEngineRobotsDb" : "WEB-INF\/robots.db", "templateLoaderClass" : "org.cofax.FilesTemplateLoader", "templateOverridePath" : "", "templatePath" : "templates", "templateProcessorClass" : "org.cofax.WysiwygTemplate", "useDataStore" : true, "useJSP" : false}, "servlet-class" : "org.cofax.cds.CDSServlet", "servlet-name" : "cofaxCDS"}, {"init-param" : {"mailHost" : "mail1", "mailHostOverride" : "mail2"}, "servlet-class" : "org.cofax.cds.EmailServlet", "servlet-name" : "cofaxEmail"}, {"servlet-class" : "org.cofax.cds.AdminServlet", "servlet-name" : "cofaxAdmin"}, {"servlet-class" : "org.cofax.cds.FileServlet", "servlet-name" : "fileServlet"}, {"init-param" : {"adminGroupID" : 4.0, "betaServer" : true, "dataLog" : 1.0, "dataLogLocation" : "\/usr\/local\/tomcat\/logs\/dataLog.log", "dataLogMaxSize" : "", "fileTransferFolder" : "\/usr\/local\/tomcat\/webapps\/content\/fileTransferFolder", "log" : 1.0, "logLocation" : "\/usr\/local\/tomcat\/logs\/CofaxTools.log", "logMaxSize" : "", "lookInContext" : 1.0, "removePageCache" : "\/content\/admin\/remove?cache=pages&id=", "removeTemplateCache" : "\/content\/admin\/remove?cache=templates&id=", "templatePath" : "toolstemplates\/"}, "servlet-class" : "org.cofax.cms.CofaxToolsServlet", "servlet-name" : "cofaxTools"}], "servlet-mapping" : {"cofaxAdmin" : "\/admin\/*", "cofaxCDS" : "\/", "cofaxEmail" : "\/cofaxutil\/aemail\/*", "cofaxTools" : "\/tools\/*", "fileServlet" : "\/static\/*"}, "taglib" : {"taglib-location" : "\/WEB-INF\/tlds\/cofax.tld", "taglib-uri" : "cofax.tld"}}}
-
diff --git a/test/files/run/json.scala b/test/files/run/json.scala
deleted file mode 100644
index 36e86ac5bb..0000000000
--- a/test/files/run/json.scala
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * filter: inliner warning\(s\); re-run with -Yinline-warnings for details
- */
-import scala.util.parsing.json._
-import scala.collection.immutable.TreeMap
-
-@deprecated("Suppress warnings", since="2.11")
-object Test extends App {
- /* This method converts parsed JSON back into real JSON notation with objects in
- * sorted-key order. Not required by the spec, but it allows us to do a stable
- * toString comparison. */
- def jsonToString(in : Any) : String = in match {
- case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]"
- case m : Map[String @unchecked,_] => "{" + m.iterator.toList
- .sortWith({ (x,y) => x._1 < y._1 })
- .map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) })
- .mkString(", ") + "}"
- case s : String => "\"" + s + "\""
- case x => x.toString
- }
-
- /*
- * This method takes input JSON values and sorts keys on objects.
- */
- def sortJSON(in : Any) : Any = in match {
- case l : List[_] => l.map(sortJSON)
- case m : Map[String @unchecked,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*)
- // For the object versions, sort their contents, ugly casts and all...
- case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]])
- case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]])
- case x => x
- }
-
- // For this one, just parsing should be considered a pass
- def printJSON(given : String) {
- JSON parseRaw given match {
- case None => println("Parse failed for \"%s\"".format(given))
- case Some(parsed) => println("Passed parse : " + sortJSON(parsed))
- }
- }
-
- // For this usage, do a raw parse (to JSONObject/JSONArray)
- def printJSON(given : String, expected : JSONType) {
- printJSON(given, JSON.parseRaw, expected)
- }
-
- // For this usage, do a raw parse (to JSONType and subclasses)
- def printJSONFull(given : String, expected : Any) {
- printJSON(given, JSON.parseFull, expected)
- }
-
- // For this usage, do configurable parsing so that you can do raw if desired
- def printJSON[T](given : String, parser : String => T, expected : Any) {
- parser(given) match {
- case None => println("Parse failed for \"%s\"".format(given))
- case Some(parsed) => if (parsed == expected) {
- println("Passed compare: " + parsed)
- } else {
- val eStr = sortJSON(expected).toString
- val pStr = sortJSON(parsed).toString
- stringDiff(eStr,pStr)
- }
- }
- }
-
- def stringDiff (expected : String, actual : String) {
- if (expected != actual) {
- // Figure out where the Strings differ and generate a marker
- val mismatchPosition = expected.toList.zip(actual.toList).indexWhere({case (x,y) => x != y}) match {
- case -1 => Math.min(expected.length, actual.length)
- case x => x
- }
- val reason = (" " * mismatchPosition) + "^"
- println("Expected: %s\nGot : %s \n %s".format(expected, actual, reason))
-
- } else {
- println("Passed compare: " + actual)
- }
- }
-
-
- // The library should differentiate between lower case "l" and number "1" (ticket #136)
- printJSON("{\"name\" : \"value\"}", JSONObject(Map("name" -> "value")))
- printJSON("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue")))
- printJSON("{\"name\" : { \"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\" } }",
- JSONObject(Map("name" -> JSONObject(Map("name1" -> "va1ue1", "name2" -> "va1ue2")))))
-
- // Unicode escapes should be handled properly
- printJSON("{\"name\" : \"\\u0022\"}")
-
- // The library should return a map for JSON objects (ticket #873)
- printJSONFull("{\"function\" : \"add_symbol\"}", Map("function" -> "add_symbol"))
-
- // The library should recurse into arrays to find objects (ticket #2207)
- printJSON("[{\"a\" : \"team\"},{\"b\" : 52}]", JSONArray(List(JSONObject(Map("a" -> "team")), JSONObject(Map("b" -> 52.0)))))
-
- // The library should differentiate between empty maps and lists (ticket #3284)
- printJSONFull("{}", Map())
- printJSONFull("[]", List())
-
- // Lists should be returned in the same order as specified
- printJSON("[4,1,3,2,6,5,8,7]", JSONArray(List[Double](4,1,3,2,6,5,8,7)))
-
- // Additional tests
- printJSON("{\"age\": 0}")
-
- // The library should do a proper toString representation using default and custom renderers (ticket #3605)
- stringDiff("{\"name\" : \"va1ue\"}", JSONObject(Map("name" -> "va1ue")).toString)
- stringDiff("{\"name\" : {\"name1\" : \"va1ue1\", \"name2\" : \"va1ue2\"}}",
- JSONObject(Map("name" -> JSONObject(TreeMap("name1" -> "va1ue1", "name2" -> "va1ue2")))).toString)
-
- stringDiff("[4.0, 1.0, 3.0, 2.0, 6.0, 5.0, 8.0, 7.0]", JSONArray(List[Double](4,1,3,2,6,5,8,7)).toString)
-
- // A test method that escapes all characters in strings
- def escapeEverything (in : Any) : String = in match {
- case s : String => "\"" + s.map(c => "\\u%04x".format(c : Int)).mkString + "\""
- case jo : JSONObject => jo.toString(escapeEverything)
- case ja : JSONArray => ja.toString(escapeEverything)
- case other => other.toString
- }
-
- stringDiff("{\"\\u006e\\u0061\\u006d\\u0065\" : \"\\u0076\\u0061\\u006c\"}", JSONObject(Map("name" -> "val")).toString(escapeEverything))
-
- println
-
- // from http://en.wikipedia.org/wiki/JSON
- val sample1 = """
-{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
-}"""
-
- // Should be equivalent to:
- val sample1Obj = Map(
- "firstName" -> "John",
- "lastName" -> "Smith",
- "address" -> Map(
- "streetAddress" -> "21 2nd Street",
- "city" -> "New York",
- "state" -> "NY",
- "postalCode" -> 10021
- ),
- "phoneNumbers"-> List(
- "212 732-1234",
- "646 123-4567"
- )
- )
-
-
- printJSONFull(sample1, sample1Obj)
- println
-
- // from http://www.developer.com/lang/jscript/article.php/3596836
- val sample2 = """
-{
- "fullname": "Sean Kelly",
- "org": "SK Consulting",
- "emailaddrs": [
- {"type": "work", "value": "kelly@seankelly.biz"},
- {"type": "home", "pref": 1, "value": "kelly@seankelly.tv"}
- ],
- "telephones": [
- {"type": "work", "pref": 1, "value": "+1 214 555 1212"},
- {"type": "fax", "value": "+1 214 555 1213"},
- {"type": "mobile", "value": "+1 214 555 1214"}
- ],
- "addresses": [
- {"type": "work", "format": "us",
- "value": "1234 Main StnSpringfield, TX 78080-1216"},
- {"type": "home", "format": "us",
- "value": "5678 Main StnSpringfield, TX 78080-1316"}
- ],
- "urls": [
- {"type": "work", "value": "http://seankelly.biz/"},
- {"type": "home", "value": "http://seankelly.tv/"}
- ]
-}"""
-
- printJSON(sample2)
- println
-
- // from http://json.org/example.html
- val sample3 = """
-{"web-app": {
- "servlet": [
- {
- "servlet-name": "cofaxCDS",
- "servlet-class": "org.cofax.cds.CDSServlet",
- "init-param": {
- "configGlossary:installationAt": "Philadelphia, PA",
- "configGlossary:adminEmail": "ksm@pobox.com",
- "configGlossary:poweredBy": "Cofax",
- "configGlossary:poweredByIcon": "/images/cofax.gif",
- "configGlossary:staticPath": "/content/static",
- "templateProcessorClass": "org.cofax.WysiwygTemplate",
- "templateLoaderClass": "org.cofax.FilesTemplateLoader",
- "templatePath": "templates",
- "templateOverridePath": "",
- "defaultListTemplate": "listTemplate.htm",
- "defaultFileTemplate": "articleTemplate.htm",
- "useJSP": false,
- "jspListTemplate": "listTemplate.jsp",
- "jspFileTemplate": "articleTemplate.jsp",
- "cachePackageTagsTrack": 200,
- "cachePackageTagsStore": 200,
- "cachePackageTagsRefresh": 60,
- "cacheTemplatesTrack": 100,
- "cacheTemplatesStore": 50,
- "cacheTemplatesRefresh": 15,
- "cachePagesTrack": 200,
- "cachePagesStore": 100,
- "cachePagesRefresh": 10,
- "cachePagesDirtyRead": 10,
- "searchEngineListTemplate": "forSearchEnginesList.htm",
- "searchEngineFileTemplate": "forSearchEngines.htm",
- "searchEngineRobotsDb": "WEB-INF/robots.db",
- "useDataStore": true,
- "dataStoreClass": "org.cofax.SqlDataStore",
- "redirectionClass": "org.cofax.SqlRedirection",
- "dataStoreName": "cofax",
- "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",
- "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",
- "dataStoreUser": "sa",
- "dataStorePassword": "dataStoreTestQuery",
- "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",
- "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",
- "dataStoreInitConns": 10,
- "dataStoreMaxConns": 100,
- "dataStoreConnUsageLimit": 100,
- "dataStoreLogLevel": "debug",
- "maxUrlLength": 500}},
- {
- "servlet-name": "cofaxEmail",
- "servlet-class": "org.cofax.cds.EmailServlet",
- "init-param": {
- "mailHost": "mail1",
- "mailHostOverride": "mail2"}},
- {
- "servlet-name": "cofaxAdmin",
- "servlet-class": "org.cofax.cds.AdminServlet"},
-
- {
- "servlet-name": "fileServlet",
- "servlet-class": "org.cofax.cds.FileServlet"},
- {
- "servlet-name": "cofaxTools",
- "servlet-class": "org.cofax.cms.CofaxToolsServlet",
- "init-param": {
- "templatePath": "toolstemplates/",
- "log": 1,
- "logLocation": "/usr/local/tomcat/logs/CofaxTools.log",
- "logMaxSize": "",
- "dataLog": 1,
- "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",
- "dataLogMaxSize": "",
- "removePageCache": "/content/admin/remove?cache=pages&id=",
- "removeTemplateCache": "/content/admin/remove?cache=templates&id=",
- "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",
- "lookInContext": 1,
- "adminGroupID": 4,
- "betaServer": true}}],
- "servlet-mapping": {
- "cofaxCDS": "/",
- "cofaxEmail": "/cofaxutil/aemail/*",
- "cofaxAdmin": "/admin/*",
- "fileServlet": "/static/*",
- "cofaxTools": "/tools/*"},
-
- "taglib": {
- "taglib-uri": "cofax.tld",
- "taglib-location": "/WEB-INF/tlds/cofax.tld"}
- }
-}"""
-
- printJSON(sample3)
- println
-}
diff --git a/test/files/run/jtptest.check b/test/files/run/jtptest.check
deleted file mode 100644
index 95dbd28437..0000000000
--- a/test/files/run/jtptest.check
+++ /dev/null
@@ -1,7 +0,0 @@
-[1.4] parsed: 1.1
-[1.3] parsed: 1.
-[1.3] parsed: .1
-[1.1] failure: string matching regex `(\d+(\.\d*)?|\d*\.\d+)' expected but `!' found
-
-!1
-^
diff --git a/test/files/run/jtptest.scala b/test/files/run/jtptest.scala
deleted file mode 100644
index 4d0eef9153..0000000000
--- a/test/files/run/jtptest.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-
-import scala.util.parsing.combinator.JavaTokenParsers
-import scala.util.parsing.input.CharArrayReader
-
-object TestJavaTokenParsers extends JavaTokenParsers {
-}
-
-object Test {
- import TestJavaTokenParsers._
-
- def main(args : Array[String]) {
- println(decimalNumber(new CharArrayReader("1.1".toCharArray)))
- println(decimalNumber(new CharArrayReader("1.".toCharArray)))
- println(decimalNumber(new CharArrayReader(".1".toCharArray)))
- println(decimalNumber(new CharArrayReader("!1".toCharArray)))
- }
-}
diff --git a/test/files/run/macro-auto-duplicate.check b/test/files/run/macro-auto-duplicate.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/files/run/macro-auto-duplicate.check
@@ -0,0 +1 @@
+42
diff --git a/test/files/run/macro-auto-duplicate/Macros_1.scala b/test/files/run/macro-auto-duplicate/Macros_1.scala
new file mode 100644
index 0000000000..e3df05ba50
--- /dev/null
+++ b/test/files/run/macro-auto-duplicate/Macros_1.scala
@@ -0,0 +1,17 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ val x = Ident(newTermName("x"))
+ def defAndUseX(rhs: Tree) = {
+ Block(List(ValDef(NoMods, newTermName("x"), TypeTree(), rhs)), x)
+ }
+ val xi4 = defAndUseX(Literal(Constant(4)))
+ val xs2 = defAndUseX(Literal(Constant("2")))
+ c.Expr[String](Apply(Select(xi4, newTermName("$plus")), List(xs2)))
+ }
+
+ def foo = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/macro-auto-duplicate/Test_2.scala b/test/files/run/macro-auto-duplicate/Test_2.scala
new file mode 100644
index 0000000000..f697da6020
--- /dev/null
+++ b/test/files/run/macro-auto-duplicate/Test_2.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ println(Macros.foo)
+} \ No newline at end of file
diff --git a/test/files/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala
index af80147a90..85a581585f 100644
--- a/test/files/run/macro-duplicate/Impls_Macros_1.scala
+++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala
@@ -26,4 +26,4 @@ object Macros {
}
def foo = macro impl
-} \ No newline at end of file
+}
diff --git a/test/files/run/nodebuffer-array.check b/test/files/run/nodebuffer-array.check
deleted file mode 100644
index 49f8bfaf8d..0000000000
--- a/test/files/run/nodebuffer-array.check
+++ /dev/null
@@ -1,3 +0,0 @@
-<entry>
- <elem>a</elem><elem>b</elem><elem>c</elem>
- </entry>
diff --git a/test/files/run/nodebuffer-array.scala b/test/files/run/nodebuffer-array.scala
deleted file mode 100644
index 4e1ffe1e5e..0000000000
--- a/test/files/run/nodebuffer-array.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test {
-
- def f(s: String) = {
- <entry>
- {
- for (item <- s split ',') yield
- <elem>{ item }</elem>
- }
- </entry>
- }
-
- def main(args: Array[String]): Unit = {
- println(f("a,b,c"))
- }
-}
diff --git a/test/files/run/packrat1.check b/test/files/run/packrat1.check
deleted file mode 100644
index e9f797e1b6..0000000000
--- a/test/files/run/packrat1.check
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-3
-5
-81
-4
-37
-9
diff --git a/test/files/run/packrat1.scala b/test/files/run/packrat1.scala
deleted file mode 100644
index b5a4687378..0000000000
--- a/test/files/run/packrat1.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-import scala.util.parsing.combinator._
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.input._
-import scala.util.parsing.combinator.token._
-
-import scala.collection.mutable.HashMap
-
-object Test extends App{
- import grammars._
-
- val head = phrase(term)
-
- println(extractResult(head(new lexical.Scanner("1"))))
- println(extractResult(head(new lexical.Scanner("1+2"))))
- println(extractResult(head(new lexical.Scanner("9-4"))))
- println(extractResult(head(new lexical.Scanner("9*9"))))
- println(extractResult(head(new lexical.Scanner("8/2"))))
- println(extractResult(head(new lexical.Scanner("4*9-0/7+9-8*1"))))
- println(extractResult(head(new lexical.Scanner("(1+2)*3"))))
-}
-
-object grammars extends StandardTokenParsers with PackratParsers{
-
- def extractResult(r : ParseResult[_]) = r match {
- case Success(a,_) => a
- case NoSuccess(a,_) => a
- }
-
- lexical.delimiters ++= List("+","-","*","/","(",")")
- lexical.reserved ++= List("Hello","World")
-
- /****
- * term = term + fact | term - fact | fact
- * fact = fact * num | fact / num | num
- */
-
-
- val term: PackratParser[Int] = (term~("+"~>fact) ^^ {case x~y => x+y}
- |term~("-"~>fact) ^^ {case x~y => x-y}
- |fact)
-
- val fact: PackratParser[Int] = (fact~("*"~>numericLit) ^^ {case x~y => x*y.toInt}
- |fact~("/"~>numericLit) ^^ {case x~y => x/y.toInt}
- |"("~>term<~")"
- |numericLit ^^ {_.toInt})
- }
diff --git a/test/files/run/packrat2.check b/test/files/run/packrat2.check
deleted file mode 100644
index 55a32ac58b..0000000000
--- a/test/files/run/packrat2.check
+++ /dev/null
@@ -1,7 +0,0 @@
-1
-3
-81
-43
-59
-188
-960
diff --git a/test/files/run/packrat2.scala b/test/files/run/packrat2.scala
deleted file mode 100644
index f55021a6a8..0000000000
--- a/test/files/run/packrat2.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-import scala.util.parsing.combinator._
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.input._
-import scala.util.parsing.combinator.token._
-
-import scala.collection.mutable.HashMap
-
-object Test extends App{
- import grammars2._
-
- val head = phrase(exp)
-
- println(extractResult(head(new lexical.Scanner("1"))))
- println(extractResult(head(new lexical.Scanner("1+2"))))
- println(extractResult(head(new lexical.Scanner("9*9"))))
- println(extractResult(head(new lexical.Scanner("4*9+7"))))
- println(extractResult(head(new lexical.Scanner("4*9+7*2+3*3"))))
- println(extractResult(head(new lexical.Scanner("4*9+7*2+3*3+9*5+7*6*2"))))
- println(extractResult(head(new lexical.Scanner("4*(9+7)*(2+3)*3"))))
-
-}
-
-object grammars2 extends StandardTokenParsers with PackratParsers{
-
- def extractResult(r : ParseResult[_]) = r match{
- case Success(a,_) => a
- case NoSuccess(a,_) => a
- }
-
- lexical.delimiters ++= List("+","-","*","/","(",")")
- lexical.reserved ++= List("Hello","World")
-
- /*
- * exp = sum | prod | num
- * sum = exp ~ "+" ~ num
- * prod = exp ~ "*" ~ num
- */
-
- val exp : PackratParser[Int] = sum | prod | numericLit ^^{_.toInt} | "("~>exp<~")"
- val sum : PackratParser[Int] = exp~("+"~>exp) ^^ {case x~y => x+y}
- val prod: PackratParser[Int] = exp~("*"~>(numericLit ^^{_.toInt} | exp)) ^^ {case x~y => x*y}
-
-
- /* lexical.reserved ++= List("a","b", "c")
- val a : PackratParser[Any] = numericLit^^{x => primeFactors(x.toInt)}
- val b : PackratParser[Any] = memo("b")
- val c : PackratParser[Any] = memo("c")
- val AnBnCn : PackratParser[Any] =
- parseButDontEat(repMany1(a,b))~not(b)~>rep1(a)~repMany1(b,c)// ^^{case x~y => x:::y}
- //val c : PackratParser[Any] = parseButDontEat(a)~a~a
- //println(c((new PackratReader(new lexical.Scanner("45 24")))))
- val r = new PackratReader(new lexical.Scanner("45 b c"))
- println(AnBnCn(r))
- println(r.getCache.size)
-*/
-}
diff --git a/test/files/run/packrat3.check b/test/files/run/packrat3.check
deleted file mode 100644
index 8c10626751..0000000000
--- a/test/files/run/packrat3.check
+++ /dev/null
@@ -1,7 +0,0 @@
-(((List(a, b)~())~List(a))~List(b, c))
-(((List(a, a, b, b)~())~List(a, a))~List(b, b, c, c))
-(((List(a, a, a, b, b, b)~())~List(a, a, a))~List(b, b, b, c, c, c))
-(((List(a, a, a, a, b, b, b, b)~())~List(a, a, a, a))~List(b, b, b, b, c, c, c, c))
-Expected failure
-``b'' expected but `c' found
-end of input
diff --git a/test/files/run/packrat3.scala b/test/files/run/packrat3.scala
deleted file mode 100644
index 216ef8f0af..0000000000
--- a/test/files/run/packrat3.scala
+++ /dev/null
@@ -1,51 +0,0 @@
-import scala.util.parsing.combinator._
-
-import scala.util.parsing.combinator.syntactical.StandardTokenParsers
-import scala.util.parsing.input._
-import scala.util.parsing.combinator.token._
-
-import scala.collection.mutable.HashMap
-
-object Test {
- def main(args: Array[String]): Unit = {
- import grammars3._
-
- val head = phrase(AnBnCn)
-
- println(extractResult(head(new lexical.Scanner("a b c"))))
- println(extractResult(head(new lexical.Scanner("a a b b c c"))))
- println(extractResult(head(new lexical.Scanner("a a a b b b c c c"))))
- println(extractResult(head(new lexical.Scanner("a a a a b b b b c c c c"))))
-
- println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a b b b b c c c c")))))
- println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a a b b b c c c c")))))
- println(extractResult(AnBnCn(new PackratReader(new lexical.Scanner("a a a a b b b b c c c")))))
- }
-}
-
-object grammars3 extends StandardTokenParsers with PackratParsers {
-
- def extractResult(r: ParseResult[_]) = r match {
- case Success(a,_) => a
- case NoSuccess(a,_) => a
- }
-
-
- lexical.reserved ++= List("a","b", "c")
- val a: PackratParser[Any] = memo("a")
- val b: PackratParser[Any] = memo("b")
- val c: PackratParser[Any] = memo("c")
-
- val AnBnCn: PackratParser[Any] =
- guard(repMany1(a,b) ~ not(b)) ~ rep1(a) ~ repMany1(b,c)// ^^{case x~y => x:::y}
-
-
- private def repMany[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] =
- ( p~repMany(p,q)~q ^^ {case x~xs~y => x::xs:::(y::Nil)}
- | success(Nil)
- )
-
- def repMany1[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] =
- p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)}
-
-}
diff --git a/test/files/run/parserFilter.check b/test/files/run/parserFilter.check
deleted file mode 100644
index be04454426..0000000000
--- a/test/files/run/parserFilter.check
+++ /dev/null
@@ -1,9 +0,0 @@
-[1.3] failure: Input doesn't match filter: false
-
-if false
- ^
-[1.1] failure: Input doesn't match filter: not
-
-not true
-^
-[1.8] parsed: (if~true)
diff --git a/test/files/run/parserFilter.scala b/test/files/run/parserFilter.scala
deleted file mode 100644
index d007d441f4..0000000000
--- a/test/files/run/parserFilter.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test extends scala.util.parsing.combinator.RegexParsers {
- val keywords = Set("if", "false")
- def word: Parser[String] = "\\w+".r
-
- def keyword: Parser[String] = word filter (keywords.contains)
- def ident: Parser[String] = word filter(!keywords.contains(_))
-
- def test = keyword ~ ident
-
- def main(args: Array[String]) {
- println(parseAll(test, "if false"))
- println(parseAll(test, "not true"))
- println(parseAll(test, "if true"))
- }
-}
diff --git a/test/files/run/parserForFilter.check b/test/files/run/parserForFilter.check
deleted file mode 100644
index a53c147719..0000000000
--- a/test/files/run/parserForFilter.check
+++ /dev/null
@@ -1 +0,0 @@
-[1.13] parsed: (second,first)
diff --git a/test/files/run/parserForFilter.scala b/test/files/run/parserForFilter.scala
deleted file mode 100644
index 1bc44f8033..0000000000
--- a/test/files/run/parserForFilter.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test extends scala.util.parsing.combinator.RegexParsers {
- def word: Parser[String] = "\\w+".r
-
- def twoWords = for {
- (a ~ b) <- word ~ word
- } yield (b, a)
-
- def main(args: Array[String]) {
- println(parseAll(twoWords, "first second"))
- }
-}
-
diff --git a/test/files/run/parserJavaIdent.check b/test/files/run/parserJavaIdent.check
deleted file mode 100644
index 597ddbee47..0000000000
--- a/test/files/run/parserJavaIdent.check
+++ /dev/null
@@ -1,26 +0,0 @@
-[1.7] parsed: simple
-[1.8] parsed: with123
-[1.6] parsed: with$
-[1.10] parsed: withøßöèæ
-[1.6] parsed: with_
-[1.6] parsed: _with
-[1.1] failure: java identifier expected
-
-3start
-^
-[1.1] failure: java identifier expected
-
--start
-^
-[1.5] failure: java identifier expected
-
-with-s
- ^
-[1.3] failure: java identifier expected
-
-we♥scala
- ^
-[1.6] failure: java identifier expected
-
-with space
- ^
diff --git a/test/files/run/parserJavaIdent.scala b/test/files/run/parserJavaIdent.scala
deleted file mode 100644
index c068075e4e..0000000000
--- a/test/files/run/parserJavaIdent.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-object Test extends scala.util.parsing.combinator.JavaTokenParsers {
-
- def test[A](s: String) {
- val res = parseAll(ident, s) match {
- case Failure(_, in) => Failure("java identifier expected", in)
- case o => o
- }
- println(res)
- }
-
- def main(args: Array[String]) {
- // Happy tests
- test("simple")
- test("with123")
- test("with$")
- test("withøßöèæ")
- test("with_")
- test("_with")
- // Sad tests
- test("3start")
- test("-start")
- test("with-s")
- test("we♥scala")
- test("with space")
- }
-}
diff --git a/test/files/run/parserNoSuccessMessage.check b/test/files/run/parserNoSuccessMessage.check
deleted file mode 100644
index fe00d2fd3a..0000000000
--- a/test/files/run/parserNoSuccessMessage.check
+++ /dev/null
@@ -1,20 +0,0 @@
-[1.2] failure: string matching regex `\d+' expected but `x' found
-
--x
- ^
-[1.1] failure: string matching regex `\d+' expected but `x' found
-
-x
-^
-[1.3] parsed: (Some(-)~5)
-[1.2] parsed: (None~5)
-[1.2] error: Number expected!
-
--x
- ^
-[1.1] error: Number expected!
-
-x
-^
-[1.3] parsed: (Some(-)~5)
-[1.2] parsed: (None~5)
diff --git a/test/files/run/parserNoSuccessMessage.scala b/test/files/run/parserNoSuccessMessage.scala
deleted file mode 100644
index 93aa252db0..0000000000
--- a/test/files/run/parserNoSuccessMessage.scala
+++ /dev/null
@@ -1,19 +0,0 @@
-object Test extends scala.util.parsing.combinator.RegexParsers {
- def sign = "-"
- def number = "\\d+".r
- def p = sign.? ~ number withErrorMessage "Number expected!"
- def q = sign.? ~! number withErrorMessage "Number expected!"
-
- def main(args: Array[String]) {
- println(parseAll(p, "-x"))
- println(parseAll(p, "x"))
- println(parseAll(p, "-5"))
- println(parseAll(p, "5"))
- println(parseAll(q, "-x"))
- println(parseAll(q, "x"))
- println(parseAll(q, "-5"))
- println(parseAll(q, "5"))
- }
-}
-
-
diff --git a/test/files/run/reflect-priv-ctor.check b/test/files/run/reflect-priv-ctor.check
new file mode 100644
index 0000000000..a0fb1943b7
--- /dev/null
+++ b/test/files/run/reflect-priv-ctor.check
@@ -0,0 +1 @@
+privately constructed
diff --git a/test/files/run/reflect-priv-ctor.scala b/test/files/run/reflect-priv-ctor.scala
new file mode 100644
index 0000000000..9cb3e658cd
--- /dev/null
+++ b/test/files/run/reflect-priv-ctor.scala
@@ -0,0 +1,22 @@
+
+import language.postfixOps
+import reflect.runtime._
+import universe._
+
+object Test {
+
+ class Foo private () {
+ override def toString = "privately constructed"
+ }
+
+ def main(args: Array[String]): Unit = {
+
+ //val foo = new Foo // no access
+ val klass = currentMirror reflectClass typeOf[Foo].typeSymbol.asClass
+ val init = typeOf[Foo].members find { case m: MethodSymbol => m.isConstructor case _ => false } get
+ val ctor = klass reflectConstructor init.asMethod
+ val foo = ctor() // no access?
+ Console println foo
+ }
+}
+
diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check
index f5258efeb7..352aefaf25 100644
--- a/test/files/run/reflection-magicsymbols-invoke.check
+++ b/test/files/run/reflection-magicsymbols-invoke.check
@@ -82,7 +82,7 @@ Array
it's important to print the list of Array's members
if some of them change (possibly, adding and/or removing magic symbols), we must update this test
constructor Array: (_length: Int)Array[T]
-constructor Object: ()java.lang.Object
+constructor Cloneable: ()java.lang.Cloneable
method !=: (x$1: Any)Boolean
method !=: (x$1: AnyRef)Boolean
method ##: ()Int
diff --git a/test/files/run/repl-backticks.check b/test/files/run/repl-backticks.check
deleted file mode 100644
index c0561abd7c..0000000000
--- a/test/files/run/repl-backticks.check
+++ /dev/null
@@ -1,2 +0,0 @@
-import java.lang.Thread.`yield`
-import scala.`package`.Throwable
diff --git a/test/files/run/repl-backticks.scala b/test/files/run/repl-backticks.scala
deleted file mode 100644
index ec2691d9c5..0000000000
--- a/test/files/run/repl-backticks.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-import scala.tools.nsc._
-
-object Test {
- val testCode = <code>
- import java.lang.Thread.`yield`
- import scala.`package`.Throwable
-
- `yield`
- </code>.text
-
- def main(args: Array[String]) {
- val settings = new Settings()
- settings.classpath.value = System.getProperty("java.class.path")
- val repl = new interpreter.IMain(settings)
- repl.interpret(testCode)
- }
-}
-
diff --git a/test/files/run/repl-trim-stack-trace.scala b/test/files/run/repl-trim-stack-trace.scala
index bbf46f2f19..70ee8e1840 100644
--- a/test/files/run/repl-trim-stack-trace.scala
+++ b/test/files/run/repl-trim-stack-trace.scala
@@ -1,10 +1,11 @@
-import scala.tools.partest.SessionTest
+import scala.tools.partest.{ SessionTest, Welcoming }
// SI-7740
-object Test extends SessionTest {
+object Test extends SessionTest with Welcoming {
def session =
-"""Type in expressions to have them evaluated.
+"""Welcome to Scala
+Type in expressions to have them evaluated.
Type :help for more information.
scala> def f = throw new Exception("Uh-oh")
@@ -13,6 +14,7 @@ f: Nothing
scala> f
java.lang.Exception: Uh-oh
at .f(<console>:7)
+ ... 69 elided
scala> def f = throw new Exception("")
f: Nothing
@@ -20,6 +22,7 @@ f: Nothing
scala> f
java.lang.Exception:
at .f(<console>:7)
+ ... 69 elided
scala> def f = throw new Exception
f: Nothing
@@ -27,7 +30,16 @@ f: Nothing
scala> f
java.lang.Exception
at .f(<console>:7)
+ ... 69 elided
scala> """
+ // normalize the "elided" lines because the frame count depends on test context
+ lazy val elided = """(\s+\.{3} )\d+( elided)""".r
+ override def normalize(line: String) = line match {
+ case welcome(w) => w
+ case elided(ellipsis, suffix) => s"$ellipsis???$suffix"
+ case s => s
+ }
+ override def expected = super.expected map normalize
}
diff --git a/test/files/run/t0486.check b/test/files/run/t0486.check
deleted file mode 100644
index dd1ec28223..0000000000
--- a/test/files/run/t0486.check
+++ /dev/null
@@ -1,8 +0,0 @@
-<wsdl:definitions name="service1" xmlns:tns="target1">
- </wsdl:definitions>
-<wsdl:definitions name="service2" xmlns:tns="target2">
- </wsdl:definitions>
-<wsdl:definitions name="service3" xmlns:tns="target3">
- </wsdl:definitions>
-<wsdl:definitions name="service4" xmlns:tns="target4">
- </wsdl:definitions>
diff --git a/test/files/run/t0486.scala b/test/files/run/t0486.scala
deleted file mode 100644
index d3ed8f4225..0000000000
--- a/test/files/run/t0486.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-object Test extends App {
- import scala.xml._
-
- def wsdlTemplate1(serviceName: String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { "target1" } >
- </wsdl:definitions>;
-
- def wsdlTemplate2(serviceName: String, targetNamespace: String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { targetNamespace } >
- </wsdl:definitions>;
-
- def wsdlTemplate3(serviceName: String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { Text("target3") } >
- </wsdl:definitions>;
-
- def wsdlTemplate4(serviceName: String, targetNamespace: () => String): Node =
- <wsdl:definitions name={serviceName} xmlns:tns = { targetNamespace() } >
- </wsdl:definitions>;
-
- println(wsdlTemplate1("service1"))
- println(wsdlTemplate2("service2", "target2"))
- println(wsdlTemplate3("service3"))
- println(wsdlTemplate4("service4", () => "target4"))
-}
diff --git a/test/files/run/t0663.check b/test/files/run/t0663.check
deleted file mode 100755
index dd9be2af70..0000000000
--- a/test/files/run/t0663.check
+++ /dev/null
@@ -1 +0,0 @@
-<feed/>
diff --git a/test/files/run/t0663.scala b/test/files/run/t0663.scala
deleted file mode 100644
index dd0326d4e3..0000000000
--- a/test/files/run/t0663.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- val src = scala.io.Source.fromString("<?xml version='1.0' encoding='UTF-8'?><feed/>")
- val parser = xml.parsing.ConstructingParser.fromSource(src, true)
- println(parser.document)
-}
-
diff --git a/test/files/run/t0700.check b/test/files/run/t0700.check
deleted file mode 100644
index b4eabbab1a..0000000000
--- a/test/files/run/t0700.check
+++ /dev/null
@@ -1,2 +0,0 @@
-[3.2] parsed: List(2, 2, 2)
-[3.2] parsed: List(2, 2, 2)
diff --git a/test/files/run/t0700.scala b/test/files/run/t0700.scala
deleted file mode 100644
index 5a7180528c..0000000000
--- a/test/files/run/t0700.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import java.io.{File,StringReader}
-
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.{CharArrayReader, StreamReader}
-
-class TestParsers extends Parsers {
- type Elem = Char
-
- def p: Parser[List[Int]] = rep(p1 | p2)
- def p1: Parser[Int] = 'a' ~ nl ~ 'b' ~ nl ^^^ 1
- def p2: Parser[Int] = 'a' ~ nl ^^^ 2
- def nl: Parser[Int] = rep(accept('\n') | accept('\r')) ^^^ 0
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- val tstParsers = new TestParsers
- val s = "a\na\na"
- val r1 = new CharArrayReader(s.toCharArray())
- val r2 = StreamReader(new StringReader(s))
- println(tstParsers.p(r1))
- println(tstParsers.p(r2))
- }
-}
diff --git a/test/files/run/t1079.scala b/test/files/run/t1079.scala
deleted file mode 100644
index ce435d254b..0000000000
--- a/test/files/run/t1079.scala
+++ /dev/null
@@ -1,3 +0,0 @@
-object Test extends App {
- println(<t user:tag=""/> == <t user:tag="X"/>)
-}
diff --git a/test/files/run/t1100.check b/test/files/run/t1100.check
deleted file mode 100644
index d3a49a47df..0000000000
--- a/test/files/run/t1100.check
+++ /dev/null
@@ -1,4 +0,0 @@
-[1.4] error: errors are propagated
-
-aaab
- ^
diff --git a/test/files/run/t1100.scala b/test/files/run/t1100.scala
deleted file mode 100644
index 6b95fd6ecb..0000000000
--- a/test/files/run/t1100.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.CharSequenceReader
-
-class TestParsers extends Parsers {
- type Elem = Char
-
- def p: Parser[List[Char]] = rep1(p1)
- def p1: Parser[Char] = accept('a') | err("errors are propagated")
-}
-
-object Test {
- def main(args: Array[String]): Unit = {
- val tstParsers = new TestParsers
- val s = new CharSequenceReader("aaab")
- println(tstParsers.p(s))
- }
-}
diff --git a/test/files/run/t1500.check b/test/files/run/t1500.check
deleted file mode 100644
index 94a169333b..0000000000
--- a/test/files/run/t1500.check
+++ /dev/null
@@ -1,3 +0,0 @@
-defined class posingAs
-resolve: [A, B](x: A @posingAs[B])B
-x: Any = 7
diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala
deleted file mode 100644
index 75a6e31cdf..0000000000
--- a/test/files/run/t1500.scala
+++ /dev/null
@@ -1,46 +0,0 @@
-import scala.tools.nsc._
-
-object Test {
-
- /**
- * Type inference overlooks constraints posed by type parameters in annotations on types.
- */
-
- val testCode = <code>
-
- class posingAs[A] extends annotation.TypeConstraint
-
- def resolve[A,B](x: A @posingAs[B]): B = x.asInstanceOf[B]
-
- val x = resolve(7: @posingAs[Any])
-
- </code>.text
-
- def main(args: Array[String]) {
-
- val settings = new Settings()
- settings.classpath.value = System.getProperty("java.class.path")
- val tool = new interpreter.IMain(settings)
- val global = tool.global
-
- import global._
- import definitions._
-
- object checker extends AnnotationChecker {
-
- /** Check annotations to decide whether tpe1 <:< tpe2 */
- def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
-
- tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp))
-
- }
- }
-
- global.addAnnotationChecker(checker)
-
- tool.interpret(testCode)
-
- }
-
-}
-
diff --git a/test/files/run/t1501.check b/test/files/run/t1501.check
deleted file mode 100644
index f0fa9112a5..0000000000
--- a/test/files/run/t1501.check
+++ /dev/null
@@ -1,3 +0,0 @@
-defined class xyz
-loopWhile: [T](cond: => Boolean)(body: => Unit @xyz[T])Unit @xyz[T]
-test: ()Unit @xyz[Int]
diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala
deleted file mode 100644
index 71ad0aeb5c..0000000000
--- a/test/files/run/t1501.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-import scala.tools.nsc._
-
-object Test {
-
- /**
- * ...
- */
-
- val testCode = <code>
-
- class xyz[A] extends annotation.TypeConstraint
-
- def loopWhile[T](cond: =>Boolean)(body: =>(Unit @xyz[T])): Unit @ xyz[T] = {{
- if (cond) {{
- body
- loopWhile[T](cond)(body)
- }}
- }}
-
- def test() = {{
- var x = 7
- loopWhile(x != 0) {{
- x = x - 1
- (): @xyz[Int]
- }}
- }}
-
- </code>.text
-
- def main(args: Array[String]) {
- val settings = new Settings()
- settings.classpath.value = System.getProperty("java.class.path")
- val tool = new interpreter.IMain(settings)
- val global = tool.global
-
- import global._
- import definitions._
-
- object checker extends AnnotationChecker {
-
- /** Check annotations to decide whether tpe1 <:< tpe2 */
- def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
-
- tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp))
-
- }
- }
-
- global.addAnnotationChecker(checker)
-
- tool.interpret(testCode)
-
- }
-
-}
-
diff --git a/test/files/run/t1620.check b/test/files/run/t1620.check
deleted file mode 100755
index afa1e6acd5..0000000000
--- a/test/files/run/t1620.check
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!DOCTYPE foo PUBLIC "-//Foo Corp//DTD 1.0//EN" "foo.dtd">
-<foo/>
-<?xml version='1.0' encoding='utf-8'?>
-<!DOCTYPE foo PUBLIC "-//Foo Corp//DTD 1.0//EN">
-<foo/>
diff --git a/test/files/run/t1620.scala b/test/files/run/t1620.scala
deleted file mode 100644
index e8ea06eb5f..0000000000
--- a/test/files/run/t1620.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-import java.io.PrintWriter
-import scala.xml.XML
-import scala.xml.dtd.{DocType, PublicID}
-
-object Test extends App {
- val dt = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", "foo.dtd"), Seq())
- val pw = new PrintWriter(System.out)
- XML.write(pw, <foo/>, "utf-8", true, dt)
- pw.println()
- pw.flush()
-
- val dt2 = DocType("foo", PublicID("-//Foo Corp//DTD 1.0//EN", null), Seq())
- XML.write(pw, <foo/>, "utf-8", true, dt2)
- pw.println()
- pw.flush()
-}
diff --git a/test/files/run/t1773.scala b/test/files/run/t1773.scala
deleted file mode 100644
index c50b62512f..0000000000
--- a/test/files/run/t1773.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test extends App
-{
- val xs = List(
- <a></a>,
- <a/>,
- <a>{ xml.NodeSeq.Empty }</a>,
- <a>{""}</a>,
- <a>{ if (true) "" else "I like turtles" }</a>
- )
-
- for (x1 <- xs; x2 <- xs) assert (x1 xml_== x2)
-}
diff --git a/test/files/run/t2124.check b/test/files/run/t2124.check
deleted file mode 100755
index 51b40469aa..0000000000
--- a/test/files/run/t2124.check
+++ /dev/null
@@ -1 +0,0 @@
-<p><lost/><q/></p>
diff --git a/test/files/run/t2124.scala b/test/files/run/t2124.scala
deleted file mode 100644
index a4fd654d76..0000000000
--- a/test/files/run/t2124.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-import scala.xml._
-
-import scala.xml.transform._
-
-object Test {
- val sampleXml = <p><lost/><t><s><r></r></s></t></p>
-
- def main(args: scala.Array[String]) {
-
- println(new RuleTransformer(new RewriteRule {
-
- override def transform(n: Node): NodeSeq = {
- val result = n match {
- case <t>{_*}</t> => <q/>
-
- case n => n
-
- }
-// println ("Rewriting '" +n+ "' to: '" + result+ "'")
-
- result
- }
- }).transform(sampleXml))
- }
-}
diff --git a/test/files/run/t2125.check b/test/files/run/t2125.check
deleted file mode 100755
index 51b40469aa..0000000000
--- a/test/files/run/t2125.check
+++ /dev/null
@@ -1 +0,0 @@
-<p><lost/><q/></p>
diff --git a/test/files/run/t2125.scala b/test/files/run/t2125.scala
deleted file mode 100644
index a10ed9827b..0000000000
--- a/test/files/run/t2125.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-import scala.xml._
-
-import scala.xml.transform._
-
-object Test {
-
- val sampleXml = <xml:group><p><lost/><t><s><r></r></s></t></p></xml:group>
-
- def main(args: scala.Array[String]) {
- println(new RuleTransformer(new RewriteRule {
-
- override def transform(n: Node): NodeSeq = {
-
- val result = n match {
-
- case <t>{_*}</t> => <q/>
-
- case n => n
- }
-// println ("Rewriting '" +n+ "' to: '" + result+ "'")
- result
- }
- }).transform(sampleXml))
- }
-}
diff --git a/test/files/run/t2276.check b/test/files/run/t2276.check
deleted file mode 100644
index 95f51c8e29..0000000000
--- a/test/files/run/t2276.check
+++ /dev/null
@@ -1,8 +0,0 @@
-<root>
- <subnode>
- <version>2</version>
- </subnode>
- <contents>
- <version>2</version>
- </contents>
- </root>
diff --git a/test/files/run/t2276.scala b/test/files/run/t2276.scala
deleted file mode 100644
index f0404e5fab..0000000000
--- a/test/files/run/t2276.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import scala.xml._
-import scala.xml.transform._
-
-object Test extends App {
- val inputXml : Node =
- <root>
- <subnode>
- <version>1</version>
- </subnode>
- <contents>
- <version>1</version>
- </contents>
- </root>
-
- object t1 extends RewriteRule {
- override def transform(n: Node): Seq[Node] = n match {
- case <version>{x}</version> if x.toString.toInt < 4 => <version>{x.toString.toInt+1}</version>
- case other => other
- }
- }
-
- val ruleTransformer = new RuleTransformer(t1)
- println(ruleTransformer(inputXml))
-}
diff --git a/test/files/run/t2354.scala b/test/files/run/t2354.scala
deleted file mode 100644
index 5419911ac3..0000000000
--- a/test/files/run/t2354.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-import scala.xml.parsing._
-import scala.io.Source
-
-object Test
-{
- val xml_good = "<title><![CDATA[Hello [tag]]]></title>"
- val xml_bad = "<title><![CDATA[Hello [tag] ]]></title>"
-
- val parser1 = ConstructingParser.fromSource(Source.fromString(xml_good),false)
- val parser2 = ConstructingParser.fromSource(Source.fromString(xml_bad),false)
-
- def main(args: Array[String]): Unit = {
- parser1.document
- parser2.document
- }
-}
-
diff --git a/test/files/run/t2721.check b/test/files/run/t2721.check
deleted file mode 100644
index 2bd7656b36..0000000000
--- a/test/files/run/t2721.check
+++ /dev/null
@@ -1,2 +0,0 @@
-root:-rootVal-sub:-subVal-
-root:-rootVal-sub:-subVal-
diff --git a/test/files/run/t2721.scala b/test/files/run/t2721.scala
deleted file mode 100644
index 93af884a60..0000000000
--- a/test/files/run/t2721.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test
-{
- val xml1 = <root xmlns:ns="nsUri" ns:at="rootVal"><sub ns:at="subVal"/></root>
- val xml2= scala.xml.XML.loadString("""<root xmlns:ns="nsUri" ns:at="rootVal"><sub ns:at="subVal"/></root>""")
-
- def backslashSearch(x: xml.Elem) = "root:-"+(x \ "@{nsUri}at") +"-sub:-"+(x \ "sub" \ "@{nsUri}at") +"-"
-
- def main(args: Array[String]): Unit = {
- println(backslashSearch(xml1))
- println(backslashSearch(xml2))
- }
-}
diff --git a/test/files/run/t3705.scala b/test/files/run/t3705.scala
deleted file mode 100644
index 3ebf6fc95d..0000000000
--- a/test/files/run/t3705.scala
+++ /dev/null
@@ -1,17 +0,0 @@
-// package foo
-
-import scala.xml._
-object Test {
- // guard caused verifyerror in oldpatmat
- def updateNodes(ns: Seq[Node]): Seq[Node] =
- for(subnode <- ns) yield subnode match {
- case <d>{_}</d> if true => <d>abc</d>
- case Elem(prefix, label, attribs, scope, children @ _*) =>
- Elem(prefix, label, attribs, scope, minimizeEmpty = true, updateNodes(children) : _*)
- case other => other
- }
- def main(args: Array[String]): Unit = {
- updateNodes(<b />)
- }
-}
-
diff --git a/test/files/run/t3886.scala b/test/files/run/t3886.scala
deleted file mode 100644
index 1e8e7ad252..0000000000
--- a/test/files/run/t3886.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test {
- def main(args: Array[String]) {
- assert( <k a="1" b="2"/> == <k a="1" b="2"/> )
- assert( <k a="1" b="2"/> != <k a="1" b="3"/> )
- assert( <k a="1" b="2"/> != <k a="2" b="2"/> )
-
- assert( <k a="1" b="2"/> != <k/> )
- assert( <k a="1" b="2"/> != <k a="1"/> )
- assert( <k a="1" b="2"/> != <k b="2"/> )
- }
-}
diff --git a/test/files/run/t4124.check b/test/files/run/t4124.check
deleted file mode 100644
index 66a0092d93..0000000000
--- a/test/files/run/t4124.check
+++ /dev/null
@@ -1,4 +0,0 @@
-hi
-hi
-bye
-bye
diff --git a/test/files/run/t4124.scala b/test/files/run/t4124.scala
deleted file mode 100644
index 9f35b57ce3..0000000000
--- a/test/files/run/t4124.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-import xml.Node
-
-object Test extends App {
- val body: Node = <elem>hi</elem>
- println ((body: AnyRef, "foo") match {
- case (node: Node, "bar") => "bye"
- case (ser: Serializable, "foo") => "hi"
- })
-
- println ((body, "foo") match {
- case (node: Node, "bar") => "bye"
- case (ser: Serializable, "foo") => "hi"
- })
-
- println ((body: AnyRef, "foo") match {
- case (node: Node, "foo") => "bye"
- case (ser: Serializable, "foo") => "hi"
- })
-
- println ((body: AnyRef, "foo") match {
- case (node: Node, "foo") => "bye"
- case (ser: Serializable, "foo") => "hi"
- })
-}
diff --git a/test/files/run/t4138.check b/test/files/run/t4138.check
deleted file mode 100644
index f561b5e6b0..0000000000
--- a/test/files/run/t4138.check
+++ /dev/null
@@ -1,2 +0,0 @@
-[1.45] parsed: "lir 'de\' ' \\ \n / upa \"new\" \t parsing"
-[1.5] parsed: "s "
diff --git a/test/files/run/t4138.scala b/test/files/run/t4138.scala
deleted file mode 100644
index 131489e581..0000000000
--- a/test/files/run/t4138.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- object p extends scala.util.parsing.combinator.JavaTokenParsers
-
- println(p.parse(p.stringLiteral, """"lir 'de\' ' \\ \n / upa \"new\" \t parsing""""))
- println(p.parse(p.stringLiteral, """"s " lkjse""""))
-}
diff --git a/test/files/run/t4387.scala b/test/files/run/t4387.scala
deleted file mode 100644
index 68cbe97d08..0000000000
--- a/test/files/run/t4387.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-object Test {
- import xml.XML.loadString
- def mkElem(arg: String) = <foo a="1" b="2" c="3" d="4" e={arg} />
-
- val x1 = mkElem("5")
- val x2 = mkElem("50")
-
- def main(args: Array[String]): Unit = {
- assert(x1 == loadString("" + x1))
- assert(x2 != loadString("" + x1))
- }
-}
diff --git a/test/files/run/t4929.check b/test/files/run/t4929.check
deleted file mode 100644
index 0f0c913d55..0000000000
--- a/test/files/run/t4929.check
+++ /dev/null
@@ -1 +0,0 @@
-success \ No newline at end of file
diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala
deleted file mode 100644
index 1b0e8672d5..0000000000
--- a/test/files/run/t4929.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-import scala.util.parsing.json._
-import java.util.concurrent._
-import collection.JavaConversions._
-
-@deprecated("Suppress warnings", since="2.11")
-object Test extends App {
-
- val LIMIT = 2000
- val THREAD_COUNT = 20
- val count = new java.util.concurrent.atomic.AtomicInteger(0)
-
- val begin = new CountDownLatch(THREAD_COUNT)
- val finish = new CountDownLatch(THREAD_COUNT)
-
- val errors = new ConcurrentLinkedQueue[Throwable]
-
- (1 to THREAD_COUNT) foreach { i =>
- val thread = new Thread {
- override def run() {
- begin.await(1, TimeUnit.SECONDS)
- try {
- while (count.getAndIncrement() < LIMIT && errors.isEmpty) {
- JSON.parseFull("""{"foo": [1,2,3,4]}""")
- }
- } catch {
- case t: Throwable => errors.add(t)
- }
-
- finish.await(10, TimeUnit.SECONDS)
- }
- }
-
- thread.setDaemon(true)
- thread.start()
-
- }
-
-
- errors foreach { throw(_) }
-
- println("success")
-
-}
diff --git a/test/files/run/t5052.scala b/test/files/run/t5052.scala
deleted file mode 100644
index 9e418e8ac5..0000000000
--- a/test/files/run/t5052.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test extends App {
- assert(<elem attr={null:String} /> xml_== <elem />)
- assert(<elem attr={None} /> xml_== <elem />)
- assert(<elem /> xml_== <elem attr={null:String} />)
- assert(<elem /> xml_== <elem attr={None} />)
-}
diff --git a/test/files/run/t5115.scala b/test/files/run/t5115.scala
deleted file mode 100644
index cf25214715..0000000000
--- a/test/files/run/t5115.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-import scala.collection.Iterable
-
-object Test extends App {
- def assertHonorsIterableContract(i: Iterable[_]) = assert(i.size == i.iterator.size)
-
- assertHonorsIterableContract(<a/>.attributes)
- assertHonorsIterableContract(<a x=""/>.attributes)
- assertHonorsIterableContract(<a y={None}/>.attributes)
- assertHonorsIterableContract(<a y={None} x=""/>.attributes)
- assertHonorsIterableContract(<a a="" y={None} />.attributes)
- assertHonorsIterableContract(<a y={null:String}/>.attributes)
- assertHonorsIterableContract(<a y={null:String} x=""/>.attributes)
- assertHonorsIterableContract(<a a="" y={null:String} />.attributes)
-}
diff --git a/test/files/run/t5514.check b/test/files/run/t5514.check
deleted file mode 100644
index c68f7c9029..0000000000
--- a/test/files/run/t5514.check
+++ /dev/null
@@ -1,19 +0,0 @@
-constructed reader: 10
-constructed reader: 9
-constructed reader: 8
-constructed reader: 7
-constructed reader: 6
-constructed reader: 5
-constructed reader: 4
-constructed reader: 3
-constructed reader: 2
-constructed reader: 1
-constructed reader: 0
-[0.0] parsed: List(s10, s9, s8, s7, s6, s5, s4, s3, s2, s1)
-constructed reader: 10
-constructed reader: 9
-constructed reader: 8
-constructed reader: 7
-constructed reader: 6
-constructed reader: 5
-[0.0] parsed: List(s10, s9, s8, s7, s6) \ No newline at end of file
diff --git a/test/files/run/t5514.scala b/test/files/run/t5514.scala
deleted file mode 100644
index efd5ba6cb9..0000000000
--- a/test/files/run/t5514.scala
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-import scala.io.Source
-import scala.util.parsing.combinator.Parsers
-import scala.util.parsing.input.Reader
-import scala.util.parsing.input.Position
-
-
-
-class DemoReader(n: Int) extends Reader[String] {
- def atEnd = n == 0
- def first = if (n >= 0) "s" + n else throw new IllegalArgumentException("No more input.")
- def rest = new DemoReader(n - 1)
- def pos = new Position {
- def line = 0
- def column = 0
- def lineContents = first
- }
- println("constructed reader: " + n)
-}
-
-
-object Test extends App with Parsers {
- type Elem = String
- def startsWith(prefix: String) = acceptIf(_ startsWith prefix)("Error: " + _)
-
- val resrep = startsWith("s").*(new DemoReader(10))
- Console println resrep
-
- val resrep5 = repN(5, startsWith("s"))(new DemoReader(10))
- Console println resrep5
-}
-
-
diff --git a/test/files/run/t5843.check b/test/files/run/t5843.check
deleted file mode 100644
index 2bf97f4cdb..0000000000
--- a/test/files/run/t5843.check
+++ /dev/null
@@ -1,9 +0,0 @@
- foo="1"
- bar="2" foo="1"
-null
- bar="2"
- foo="1"
- bar="2"
- foo="1"
- bar="2" foo="1"
- bar="2" foo="1"
diff --git a/test/files/run/t5843.scala b/test/files/run/t5843.scala
deleted file mode 100644
index 43d588c7b7..0000000000
--- a/test/files/run/t5843.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-object Test extends App {
- val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null)
- val bar = scala.xml.Attribute(null, "bar", "2", foo)
- println(foo)
- println(bar)
- println(scala.xml.TopScope.getURI(foo.pre))
- println(bar remove "foo")
- println(bar remove "bar")
- println(bar remove (null, scala.xml.TopScope, "foo"))
- println(bar remove (null, scala.xml.TopScope, "bar"))
-
- val ns = scala.xml.NamespaceBinding(null, "uri", scala.xml.TopScope)
- println(bar remove (null, ns, "foo"))
- println(bar remove (null, ns, "bar"))
-}
diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check
index 2afc48495f..1ccfced1c6 100644
--- a/test/files/run/t6392b.check
+++ b/test/files/run/t6392b.check
@@ -1 +1 @@
-ModuleDef(Modifiers(), TermName("C"), Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
+ModuleDef(Modifiers(), TermName("C")#MOD, Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(())))))))
diff --git a/test/files/run/t6939.scala b/test/files/run/t6939.scala
deleted file mode 100644
index 9fe721555f..0000000000
--- a/test/files/run/t6939.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-object Test extends App {
- val foo = <x:foo xmlns:x="http://foo.com/"><x:bar xmlns:x="http://bar.com/"><x:baz/></x:bar></x:foo>
- assert(foo.child.head.scope.toString == """ xmlns:x="http://bar.com/"""")
-
- val fooDefault = <foo xmlns="http://foo.com/"><bar xmlns="http://bar.com/"><baz/></bar></foo>
- assert(fooDefault.child.head.scope.toString == """ xmlns="http://bar.com/"""")
-
- val foo2 = scala.xml.XML.loadString("""<x:foo xmlns:x="http://foo.com/"><x:bar xmlns:x="http://bar.com/"><x:baz/></x:bar></x:foo>""")
- assert(foo2.child.head.scope.toString == """ xmlns:x="http://bar.com/"""")
-
- val foo2Default = scala.xml.XML.loadString("""<foo xmlns="http://foo.com/"><bar xmlns="http://bar.com/"><baz/></bar></foo>""")
- assert(foo2Default.child.head.scope.toString == """ xmlns="http://bar.com/"""")
-}
diff --git a/test/files/run/t6989.check b/test/files/run/t6989.check
index 8943792115..43d4bbaf02 100644
--- a/test/files/run/t6989.check
+++ b/test/files/run/t6989.check
@@ -101,6 +101,12 @@ isProtected = false
isPublic = false
privateWithin = <none>
============
+sym = constructor $PrivateJavaClass, signature = ()JavaClass_1.this.$PrivateJavaClass, owner = class $PrivateJavaClass
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
sym = value this$0, signature = foo.JavaClass_1, owner = class $PrivateJavaClass
isPrivate = false
isProtected = false
@@ -119,6 +125,12 @@ isProtected = true
isPublic = false
privateWithin = package foo
============
+sym = constructor $ProtectedJavaClass, signature = ()JavaClass_1.this.$ProtectedJavaClass, owner = class $ProtectedJavaClass
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
sym = value this$0, signature = foo.JavaClass_1, owner = class $ProtectedJavaClass
isPrivate = false
isProtected = false
@@ -173,6 +185,12 @@ isProtected = false
isPublic = false
privateWithin = <none>
============
+sym = constructor PrivateStaticJavaClass, signature = ()foo.JavaClass_1.PrivateStaticJavaClass, owner = class PrivateStaticJavaClass
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
sym = object PrivateStaticJavaClass, signature = foo.JavaClass_1.PrivateStaticJavaClass.type, owner = object JavaClass_1
isPrivate = true
isProtected = false
@@ -185,6 +203,12 @@ isProtected = false
isPublic = false
privateWithin = <none>
============
+sym = constructor ProtectedStaticJavaClass, signature = ()foo.JavaClass_1.ProtectedStaticJavaClass, owner = class ProtectedStaticJavaClass
+isPrivate = false
+isProtected = false
+isPublic = true
+privateWithin = <none>
+============
sym = object ProtectedStaticJavaClass, signature = foo.JavaClass_1.ProtectedStaticJavaClass.type, owner = object JavaClass_1
isPrivate = true
isProtected = false
diff --git a/test/files/run/t7074.check b/test/files/run/t7074.check
deleted file mode 100644
index ab9cf11f16..0000000000
--- a/test/files/run/t7074.check
+++ /dev/null
@@ -1,9 +0,0 @@
-<a/>
-<a b="2" c="3" d="1"/>
-<a b="2" c="4" d="1" e="3" f="5"/>
-<a b="5" c="4" d="3" e="2" f="1"/>
-<a b="1" c="2" d="3" e="4" f="5"/>
-<a a:b="2" a:c="3" a:d="1"/>
-<a a:b="2" a:c="4" a:d="1" a:e="3" a:f="5"/>
-<a a:b="5" a:c="4" a:d="3" a:e="2" a:f="1"/>
-<a a:b="1" a:c="2" a:d="3" a:e="4" a:f="5"/>
diff --git a/test/files/run/t7074.scala b/test/files/run/t7074.scala
deleted file mode 100644
index 693a076a7a..0000000000
--- a/test/files/run/t7074.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-import scala.xml.Utility.sort
-
-object Test extends App {
- println(sort(<a/>))
- println(sort(<a d="1" b="2" c="3"/>))
- println(sort(<a d="1" b="2" e="3" c="4" f="5"/>))
- println(sort(<a f="1" e="2" d="3" c="4" b="5"/>))
- println(sort(<a b="1" c="2" d="3" e="4" f="5"/>))
-
- println(sort(<a a:d="1" a:b="2" a:c="3"/>))
- println(sort(<a a:d="1" a:b="2" a:e="3" a:c="4" a:f="5"/>))
- println(sort(<a a:f="1" a:e="2" a:d="3" a:c="4" a:b="5"/>))
- println(sort(<a a:b="1" a:c="2" a:d="3" a:e="4" a:f="5"/>))
-}
-
diff --git a/test/files/jvm/xml02.check b/test/files/run/t7510.check
index e69de29bb2..e69de29bb2 100644
--- a/test/files/jvm/xml02.check
+++ b/test/files/run/t7510.check
diff --git a/test/files/run/t7510/Ann_1.java b/test/files/run/t7510/Ann_1.java
new file mode 100644
index 0000000000..c8c5b2035f
--- /dev/null
+++ b/test/files/run/t7510/Ann_1.java
@@ -0,0 +1,4 @@
+package foo;
+
+public @interface Ann_1 {
+} \ No newline at end of file
diff --git a/test/files/run/t7510/Test_2.scala b/test/files/run/t7510/Test_2.scala
new file mode 100644
index 0000000000..7d7a95e0f2
--- /dev/null
+++ b/test/files/run/t7510/Test_2.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ tb.compile(tb.parse("@foo.Ann_1 class C"))
+}
+
diff --git a/test/files/run/t7775.scala b/test/files/run/t7775.scala
new file mode 100644
index 0000000000..5fb0327611
--- /dev/null
+++ b/test/files/run/t7775.scala
@@ -0,0 +1,17 @@
+import scala.concurrent.{duration, future, Await, ExecutionContext}
+import scala.tools.nsc.Settings
+import ExecutionContext.Implicits.global
+
+// Was failing pretty regularly with a ConcurrentModificationException as
+// WrappedProperties#systemProperties iterated directly over the mutable
+// global system properties map.
+object Test {
+ def main(args: Array[String]) {
+ val tries = 1000 // YMMV
+ val compiler = future {
+ for(_ <- 1 to tries) new Settings(_ => {})
+ }
+ for(i <- 1 to tries * 10) System.setProperty(s"foo$i", i.toString)
+ Await.result(compiler, duration.Duration.Inf)
+ }
+}
diff --git a/test/files/run/t7779.scala b/test/files/run/t7779.scala
new file mode 100644
index 0000000000..db32cb751f
--- /dev/null
+++ b/test/files/run/t7779.scala
@@ -0,0 +1,67 @@
+// -Xmax-classfile-length doesn't compress top-level classes.
+// class :::::::::::::::::::::::::::::::::::::::::::::::::
+
+trait Marker
+
+class Short extends Marker
+
+// We just test with member classes
+object O {
+ object ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker
+}
+class C {
+ class D {
+ class ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker
+ }
+}
+
+package pack {
+ // abbreviates to: $colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon to $read$$iw$$iw$$colon$colon$colon$colon$colon$colon$colon$colon$$$$c39b3f245029fbed9732fc888d44231b$$$$on$colon$colon$colon$colon$colon$colon$colon$colon$colon$colon
+ // class :::::::::::::::::::::::::::::::::::::::::::::::::
+
+ class Short extends Marker
+
+ // We just test with member classes
+ object O {
+ object ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker
+ }
+ class C {
+ class D {
+ class ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker
+ }
+ }
+ package p2 {
+ class Short extends Marker
+
+ object O {
+ object ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker
+ }
+ class C {
+ class D {
+ class ::::::::::::::::::::::::::::::::::::::::::::::::: extends Marker
+ }
+ }
+ }
+}
+
+
+object Test extends App {
+ import reflect.runtime.universe._
+ def test[T: TypeTag] = {
+ val tt = typeTag[T]
+ val clz = tt.mirror.runtimeClass(tt.tpe)
+ assert(classOf[Marker].isAssignableFrom(clz), clz.toString)
+ }
+
+ test[Short]
+ test[O.:::::::::::::::::::::::::::::::::::::::::::::::::.type]
+ test[C#D#`:::::::::::::::::::::::::::::::::::::::::::::::::`]
+
+ test[pack.Short]
+ test[pack.O.:::::::::::::::::::::::::::::::::::::::::::::::::.type]
+ test[pack.C#D#`:::::::::::::::::::::::::::::::::::::::::::::::::`]
+
+ test[pack.p2.Short]
+ test[pack.p2.O.:::::::::::::::::::::::::::::::::::::::::::::::::.type]
+ test[pack.p2.C#D#`:::::::::::::::::::::::::::::::::::::::::::::::::`]
+}
diff --git a/test/files/run/t7791-script-linenums.check b/test/files/run/t7791-script-linenums.check
new file mode 100644
index 0000000000..b7d969564a
--- /dev/null
+++ b/test/files/run/t7791-script-linenums.check
@@ -0,0 +1 @@
+hello, scripted test
diff --git a/test/files/run/t7791-script-linenums.scala b/test/files/run/t7791-script-linenums.scala
new file mode 100644
index 0000000000..d89b8d4c63
--- /dev/null
+++ b/test/files/run/t7791-script-linenums.scala
@@ -0,0 +1,16 @@
+
+import scala.tools.partest.ScriptTest
+
+object Test extends ScriptTest {
+ object ExceptionLine {
+ def unapply(e: Exception) = Some(e.getStackTrace()(0).getLineNumber)
+ }
+ override def show() = {
+ import util._
+ Try(super.show()) match {
+ case Failure(ExceptionLine(7)) => ()
+ case Failure(e) => e.printStackTrace()
+ case Success(_) => Console println "Expected error"
+ }
+ }
+}
diff --git a/test/files/run/t7791-script-linenums.script b/test/files/run/t7791-script-linenums.script
new file mode 100644
index 0000000000..403dcc2d28
--- /dev/null
+++ b/test/files/run/t7791-script-linenums.script
@@ -0,0 +1,8 @@
+#!/bin/bash
+exec ${SCALA_HOME}/bin/scala "$0" "$@" 2>&1
+!#
+
+Console println s"hello, scripted test"
+
+throw new RuntimeException("failing") // line 7
+
diff --git a/test/files/run/t7805-repl-i.check b/test/files/run/t7805-repl-i.check
new file mode 100644
index 0000000000..eecfff079a
--- /dev/null
+++ b/test/files/run/t7805-repl-i.check
@@ -0,0 +1,11 @@
+Loading t7805-repl-i.script...
+import util._
+
+Welcome to Scala
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> Console println Try(8)
+Success(8)
+
+scala>
diff --git a/test/files/run/t7805-repl-i.scala b/test/files/run/t7805-repl-i.scala
new file mode 100644
index 0000000000..a4061689f0
--- /dev/null
+++ b/test/files/run/t7805-repl-i.scala
@@ -0,0 +1,42 @@
+
+import scala.tools.partest.{ ReplTest, Welcoming }
+import scala.tools.nsc.{ GenericRunnerSettings, Settings }
+import scala.tools.nsc.settings.MutableSettings
+
+object Test extends ReplTest with HangingRepl with Welcoming {
+ def script = testPath changeExtension "script"
+ override def transformSettings(s: Settings) = s match {
+ case m: MutableSettings =>
+ val t = new GenericRunnerSettings(s.errorFn)
+ m copyInto t
+ t processArgumentString s"-i $script"
+ t
+ case _ => s
+ }
+ def code = "Console println Try(8)"
+}
+
+object Resulting {
+ import scala.concurrent._
+ import scala.concurrent.duration._
+ implicit class AwaitResult[A](val f: Future[A]) extends AnyVal {
+ def resultWithin(d: Duration): A = Await.result(f, d)
+ }
+}
+
+/** Test that hangs the REPL.
+ * Usually that is the "before" case.
+ */
+trait HangingRepl extends ReplTest {
+ import scala.language.postfixOps
+ import scala.util._
+ import scala.concurrent._
+ import scala.concurrent.duration._
+ import ExecutionContext.Implicits._
+ import Resulting._
+ def timeout = 15 seconds
+ def hanging[A](a: =>A): A = future(a) resultWithin timeout
+ override def show() = Try(hanging(super.show())) recover {
+ case e => e.printStackTrace()
+ }
+}
diff --git a/test/files/run/t7805-repl-i.script b/test/files/run/t7805-repl-i.script
new file mode 100644
index 0000000000..eb2b8705f3
--- /dev/null
+++ b/test/files/run/t7805-repl-i.script
@@ -0,0 +1 @@
+import util._
diff --git a/test/files/run/t7817-tree-gen.check b/test/files/run/t7817-tree-gen.check
new file mode 100644
index 0000000000..4ed4b0d94a
--- /dev/null
+++ b/test/files/run/t7817-tree-gen.check
@@ -0,0 +1,104 @@
+
+
+Joint Compilation:
+
+ typer [ O] - O.this
+ pickler [ O] - O.this
+ refchecks [ O] - O.this
+ uncurry [ O] - O.this
+ specialize [ O] - O.this
+ explicitouter [ O] - O.this
+ erasure [ O] - O.this
+ posterasure [ O] - C.this.O()
+ flatten [ O] - C.this.O()
+ mixin [ O] - test.O()
+ cleanup [ O] - test.O()
+
+ typer [ P] - P.this
+ pickler [ P] - P.this
+ refchecks [ P] - P.this
+ uncurry [ P] - P.this
+ specialize [ P] - P.this
+ explicitouter [ P] - P.this
+ erasure [ P] - P.this
+ posterasure [ P] - D.this.P()
+ flatten [ P] - D.this.P()
+ mixin [ P] - P()
+ cleanup [ P] - P()
+
+ typer [ test2.PO] - PO.this
+ pickler [ test2.PO] - PO.this
+ refchecks [ test2.PO] - PO.this
+ uncurry [ test2.PO] - PO.this
+ specialize [ test2.PO] - PO.this
+ explicitouter [ test2.PO] - PO.this
+ erasure [ test2.PO] - PO.this
+ posterasure [ test2.PO] - test2.`package`.PO
+ flatten [ test2.PO] - test2.`package`.PO
+ mixin [ test2.PO] - test2.package$PO
+ cleanup [ test2.PO] - test2.package$PO
+
+ typer [ test2.bar] - `package`.this.bar
+ pickler [ test2.bar] - `package`.this.bar
+ refchecks [ test2.bar] - `package`.this.bar
+ uncurry [ test2.bar] - `package`.this.bar
+ specialize [ test2.bar] - `package`.this.bar
+ explicitouter [ test2.bar] - `package`.this.bar
+ erasure [ test2.bar] - `package`.this.bar
+ posterasure [ test2.bar] - test2.`package`.bar
+ flatten [ test2.bar] - test2.`package`.bar
+ mixin [ test2.bar] - test2.`package`.bar
+ cleanup [ test2.bar] - test2.`package`.bar
+
+
+
+Separate Compilation:
+
+ typer [ O] - O.this
+ pickler [ O] - O.this
+ refchecks [ O] - O.this
+ uncurry [ O] - O.this
+ specialize [ O] - O.this
+ explicitouter [ O] - O.this
+ erasure [ O] - O.this
+ posterasure [ O] - C.this.O()
+ flatten [ O] - C.this.O()
+ mixin [ O] - testSep.O()
+ cleanup [ O] - testSep.O()
+
+ typer [ P] - P.this
+ pickler [ P] - P.this
+ refchecks [ P] - P.this
+ uncurry [ P] - P.this
+ specialize [ P] - P.this
+ explicitouter [ P] - P.this
+ erasure [ P] - P.this
+ posterasure [ P] - DSep.this.P()
+ flatten [ P] - DSep.this.P()
+ mixin [ P] - P()
+ cleanup [ P] - P()
+
+ typer [ PO] - PO.this
+ pickler [ PO] - PO.this
+ refchecks [ PO] - PO.this
+ uncurry [ PO] - PO.this
+ specialize [ PO] - PO.this
+ explicitouter [ PO] - PO.this
+ erasure [ PO] - PO.this
+ posterasure [ PO] - test2.`package`.PO
+ flatten [ PO] - test2.`package`.PO
+ mixin [ PO] - test2.package$PO
+ cleanup [ PO] - test2.package$PO
+
+ typer [testSep2.bar] - `package`.this.bar
+ pickler [testSep2.bar] - `package`.this.bar
+ refchecks [testSep2.bar] - `package`.this.bar
+ uncurry [testSep2.bar] - `package`.this.bar
+ specialize [testSep2.bar] - `package`.this.bar
+ explicitouter [testSep2.bar] - `package`.this.bar
+ erasure [testSep2.bar] - `package`.this.bar
+ posterasure [testSep2.bar] - test2.`package`.bar
+ flatten [testSep2.bar] - test2.`package`.bar
+ mixin [testSep2.bar] - test2.`package`.bar
+ cleanup [testSep2.bar] - test2.`package`.bar
+
diff --git a/test/files/run/t7817-tree-gen.flags b/test/files/run/t7817-tree-gen.flags
new file mode 100644
index 0000000000..ce6e93b3da
--- /dev/null
+++ b/test/files/run/t7817-tree-gen.flags
@@ -0,0 +1 @@
+-Ynooptimise \ No newline at end of file
diff --git a/test/files/run/t7817-tree-gen.scala b/test/files/run/t7817-tree-gen.scala
new file mode 100644
index 0000000000..a8317fda6e
--- /dev/null
+++ b/test/files/run/t7817-tree-gen.scala
@@ -0,0 +1,65 @@
+import scala.tools.partest._
+
+// Testing that `mkAttributedRef` doesn't incude the package object test.`package`,
+// under joint and separate compilation.
+
+package testSep { class C { object O } }
+package testSep2 { object `package` { object PO; def bar = 0 } }
+class DSep { object P }
+
+object Test extends CompilerTest {
+ import global._
+ override def extraSettings = super.extraSettings + " -d " + testOutput.path
+ override def sources = List(
+ """
+ package test { class C { object O } }
+ class D { object P }
+ package test2 { object `package` { object PO; def bar = 0 } }
+ """
+ )
+ def check(source: String, unit: CompilationUnit) = enteringTyper {
+ def checkTree(msg: String, t: => Tree) = {
+ val run = currentRun
+ import run._
+ val phases = List(typerPhase, picklerPhase, refchecksPhase, uncurryPhase, specializePhase,
+ explicitouterPhase, erasurePhase, posterasurePhase, flattenPhase, mixinPhase, cleanupPhase)
+ for (phase <- phases) {
+ enteringPhase(phase) {
+ val error = t.exists(t => t.symbol == NoSymbol)
+ val errorStr = if (error) "!!!" else " - "
+ println(f"$phase%18s [$msg%12s] $errorStr $t")
+ }
+ }
+ println("")
+ }
+ import rootMirror._
+
+ println("\n\nJoint Compilation:\n")
+
+ {
+ val c = staticClass("test.C")
+ val o = c.info.decl(TermName("O"))
+ checkTree("O", gen.mkAttributedQualifier(o.moduleClass.thisType))
+ val d = staticClass("D")
+ val p = d.info.decl(TermName("P"))
+ checkTree("P", gen.mkAttributedQualifier(p.moduleClass.thisType))
+ val po = staticModule("test2.package").moduleClass.info.decl(TermName("PO"))
+ checkTree("test2.PO", gen.mkAttributedQualifier(po.moduleClass.thisType))
+ checkTree("test2.bar", gen.mkAttributedRef(po.owner.info.decl(TermName("bar"))))
+ }
+
+ println("\n\nSeparate Compilation:\n")
+
+ {
+ val c = typeOf[testSep.C].typeSymbol
+ val o = c.info.decl(TermName("O"))
+ checkTree("O", gen.mkAttributedQualifier(o.moduleClass.thisType))
+ val d = staticClass("DSep")
+ val p = d.info.decl(TermName("P"))
+ checkTree("P", gen.mkAttributedQualifier(p.moduleClass.thisType))
+ val po = staticModule("test2.package").moduleClass.info.decl(TermName("PO"))
+ checkTree("PO", gen.mkAttributedQualifier(po.moduleClass.thisType))
+ checkTree("testSep2.bar", gen.mkAttributedRef(po.owner.info.decl(TermName("bar"))))
+ }
+ }
+}
diff --git a/test/files/run/t7817.scala b/test/files/run/t7817.scala
new file mode 100644
index 0000000000..905b8aeb09
--- /dev/null
+++ b/test/files/run/t7817.scala
@@ -0,0 +1,31 @@
+import language.reflectiveCalls
+
+package test {
+ class C1 {
+ object O {
+ def struct(s: {def foo: Any}) = s.foo
+ }
+ }
+ trait T {
+ object O {
+ def struct(s: {def foo: Any}) = s.foo
+ }
+ }
+ object O1 extends T
+
+ object O2 {
+ object O {
+ def struct(s: {def foo: Any}) = s.foo
+ }
+ }
+}
+
+object Test extends App {
+ object fooable { def foo = "foo" }
+ def check(result: Any) = assert(result == "foo", result.toString)
+
+ val s = new test.C1
+ check(s.O.struct(fooable))
+ check(test.O1.O.struct(fooable))
+ check(test.O2.O.struct(fooable))
+}
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index 1d4124e138..e5d8891cc7 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -391,7 +391,20 @@ object Test {
def isOdd(xs: List[Int]): TailRec[Boolean] =
if (xs.isEmpty) done(false) else tailcall(isEven(xs.tail))
+ def fib(n: Int): TailRec[Int] =
+ if (n < 2) done(n) else for {
+ x <- tailcall(fib(n - 1))
+ y <- tailcall(fib(n - 2))
+ } yield (x + y)
+
+ def rec(n: Int): TailRec[Int] =
+ if (n == 1) done(n) else for {
+ x <- tailcall(rec(n - 1))
+ } yield x
+
assert(isEven((1 to 100000).toList).result)
+ //assert(fib(40).result == 102334155) // Commented out, as it takes a long time
+ assert(rec(100000).result == 1)
}
diff --git a/test/files/run/t1079.check b/test/files/run/toolbox_current_run_compiles.check
index c508d5366f..da29283aaa 100644
--- a/test/files/run/t1079.check
+++ b/test/files/run/toolbox_current_run_compiles.check
@@ -1 +1,2 @@
+true
false
diff --git a/test/files/run/toolbox_current_run_compiles.scala b/test/files/run/toolbox_current_run_compiles.scala
new file mode 100644
index 0000000000..b48c998e64
--- /dev/null
+++ b/test/files/run/toolbox_current_run_compiles.scala
@@ -0,0 +1,28 @@
+package pkg {
+ import scala.reflect.macros.Context
+ import scala.language.experimental.macros
+
+ object Macros {
+ def impl[T: c.WeakTypeTag](c: Context) = {
+ import c.universe._
+ val sym = c.weakTypeOf[T].typeSymbol
+ val g = c.universe.asInstanceOf[scala.tools.nsc.Global]
+ c.Expr[Boolean](Literal(Constant(g.currentRun.compiles(sym.asInstanceOf[g.Symbol]))))
+ }
+ def compiles[T] = macro impl[T]
+ }
+}
+
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val cm = ru.runtimeMirror(getClass.getClassLoader)
+ val toolbox = cm.mkToolBox()
+ toolbox.eval(toolbox.parse("""{
+ class C
+ println(pkg.Macros.compiles[C])
+ println(pkg.Macros.compiles[Object])
+ }"""))
+} \ No newline at end of file
diff --git a/test/files/run/typed-annotated.check b/test/files/run/typed-annotated.check
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/test/files/run/typed-annotated.check
@@ -0,0 +1 @@
+42
diff --git a/test/files/run/typed-annotated/Macros_1.scala b/test/files/run/typed-annotated/Macros_1.scala
new file mode 100644
index 0000000000..dd18c63d90
--- /dev/null
+++ b/test/files/run/typed-annotated/Macros_1.scala
@@ -0,0 +1,17 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+class ann extends scala.annotation.StaticAnnotation
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ // val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), Ident(newTypeName("Int")))
+ val tpt = Annotated(Apply(Select(New(Ident(newTypeName("ann"))), nme.CONSTRUCTOR), List()), TypeTree(weakTypeOf[Int]))
+ c.Expr[Unit](Block(
+ List(ValDef(Modifiers(), newTermName("x"), tpt, Literal(Constant(42)))),
+ Apply(Ident(newTermName("println")), List(Ident(newTermName("x"))))))
+ }
+
+ def foo = macro impl
+} \ No newline at end of file
diff --git a/test/files/run/typed-annotated/Test_2.scala b/test/files/run/typed-annotated/Test_2.scala
new file mode 100644
index 0000000000..acfddae942
--- /dev/null
+++ b/test/files/run/typed-annotated/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/unittest_io.scala b/test/files/run/unittest_io.scala
deleted file mode 100644
index 2c3dacdf91..0000000000
--- a/test/files/run/unittest_io.scala
+++ /dev/null
@@ -1,42 +0,0 @@
-
-@deprecated("Suppress warnings", since="2.11")
-object Test {
-
- def main(args: Array[String]) {
- UTF8Tests.run()
- SourceTest.run()
- }
-
- object UTF8Tests {
- def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8")
-
- def run() {
- assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char])))
- assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char])))
- assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char])))
- assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char],
- 0xDF02.asInstanceOf[Char])))
- // a client
- val test = "{\"a\":\"\\u0022\"}"
- val expected = "a" -> "\""
-
- val parsed = scala.util.parsing.json.JSON.parseFull(test)
- val result = parsed == Some(Map(expected))
- if(result)
- assert(result)
- else {
- Console.println(parsed); assert(result)
- }
- }
- }
-
- object SourceTest {
- def run() {
- val s = "Here is a test string"
- val f = io.Source.fromBytes(s.getBytes("utf-8"))
- val b = new collection.mutable.ArrayBuffer[Char]()
- f.copyToBuffer(b)
- assert(s == new String(b.toArray))
- }
- }
-}
diff --git a/test/files/run/xml-attribute.check b/test/files/run/xml-attribute.check
deleted file mode 100644
index 3cfe3779fc..0000000000
--- a/test/files/run/xml-attribute.check
+++ /dev/null
@@ -1,12 +0,0 @@
-<t/>
-<t/>
-<t/>
-<t/>
-<t/>
-<t b="1" d="2"/>
-<t b="1" d="2"/>
-<t b="1" d="2"/>
-<t a="1" d="2"/>
-<t b="1" d="2"/>
-<t a="1" b="2" c="3"/>
-<t g="1" e="2" p:a="3" f:e="4" mgruhu:ji="5"/>
diff --git a/test/files/run/xml-attribute.scala b/test/files/run/xml-attribute.scala
deleted file mode 100644
index eb3956c41b..0000000000
--- a/test/files/run/xml-attribute.scala
+++ /dev/null
@@ -1,37 +0,0 @@
-import xml.Node
-
-object Test {
- def main(args: Array[String]): Unit = {
- val noAttr = <t/>
- val attrNull = <t a={ null: String }/>
- val attrNone = <t a={ None: Option[Seq[Node]] }/>
- val preAttrNull = <t p:a={ null: String }/>
- val preAttrNone = <t p:a={ None: Option[Seq[Node]] }/>
- assert(noAttr == attrNull)
- assert(noAttr == attrNone)
- assert(noAttr == preAttrNull)
- assert(noAttr == preAttrNone)
-
- println(noAttr)
- println(attrNull)
- println(attrNone)
- println(preAttrNull)
- println(preAttrNone)
-
- val xml1 = <t b="1" d="2"/>
- val xml2 = <t a={ null: String } p:a={ null: String } b="1" c={ null: String } d="2"/>
- val xml3 = <t b="1" c={ null: String } d="2" a={ null: String } p:a={ null: String }/>
- assert(xml1 == xml2)
- assert(xml1 == xml3)
-
- println(xml1)
- println(xml2)
- println(xml3)
-
- // Check if attribute order is retained
- println(<t a="1" d="2"/>)
- println(<t b="1" d="2"/>)
- println(<t a="1" b="2" c="3"/>)
- println(<t g="1" e="2" p:a="3" f:e="4" mgruhu:ji="5"/>)
- }
-}
diff --git a/test/files/run/xml-loop-bug.scala b/test/files/run/xml-loop-bug.scala
deleted file mode 100644
index dc155dbb02..0000000000
--- a/test/files/run/xml-loop-bug.scala
+++ /dev/null
@@ -1,14 +0,0 @@
-import java.io.{ Console => _, _ }
-import scala.io._
-import scala.xml.parsing._
-object Test {
- def main(args: Array[String]): Unit = {
- val xml = "<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "
- val sink = new PrintStream(new ByteArrayOutputStream())
- (Console withOut sink) {
- (Console withErr sink) {
- ConstructingParser.fromSource((Source fromString xml), true).document.docElem
- }
- }
- }
-}
diff --git a/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
new file mode 100644
index 0000000000..153e23d947
--- /dev/null
+++ b/test/files/scalacheck/quasiquotes/DefinitionConstructionProps.scala
@@ -0,0 +1,293 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe.build.ScalaDot
+import Flag._
+
+object DefinitionConstructionProps
+ extends QuasiquoteProperties("definition construction")
+ with ClassConstruction
+ with TraitConstruction
+ with TypeDefConstruction
+ with ValDefConstruction
+
+trait ClassConstruction { self: QuasiquoteProperties =>
+ val anyRef = ScalaDot(TypeName("AnyRef"))
+ val emtpyConstructor =
+ DefDef(Modifiers(), nme.CONSTRUCTOR, List(),
+ List(List()), TypeTree(), Block(List(pendingSuperCall), Literal(Constant(()))))
+ def classWith(name: TypeName, parents: List[Tree] = List(anyRef), body: List[DefDef] = Nil) =
+ ClassDef(
+ Modifiers(), name, List(),
+ Template(parents, emptyValDef, emtpyConstructor :: body))
+
+ property("construct case class") = test {
+ val params = q"val x: Int" :: q"val y: Int" :: Nil
+ val name = TypeName("Point")
+ assertEqAst(q"$CASE class $name(..$params)", "case class Point(x: Int, y: Int)")
+ }
+
+ property("case class bare param") = test {
+ assertEqAst(q"$CASE class Point(x: Int, y: Int)", "case class Point(private[this] val x: Int, private[this] val y: Int)")
+ }
+
+ property("generate default constructors automatically") = test {
+ val parents = List.empty[Tree]
+ assertEqAst(q"class Foo extends ..$parents", "class Foo")
+ }
+
+ property("splice term name into class") = forAll { (name: TypeName) =>
+ eqAst(q"class $name", "class " + name.toString)
+ }
+
+ property("splice method into class") = forAll { (name: TypeName, method: DefDef) =>
+ q"class $name { $method }" ≈ classWith(name, body = List(method))
+ }
+
+ property("splice members into class") = forAll { (name: TypeName, defs: List[DefDef], extra: DefDef) =>
+ q"""class $name {
+ ..$defs
+ $extra
+ }""" ≈ classWith(name, body = defs :+ extra)
+ }
+
+ property("splice type name into class parents") = forAll { (name: TypeName, parent: TypeName) =>
+ q"class $name extends $parent" ≈ classWith(name, parents = List(Ident(parent)))
+ }
+
+ property("param flags are consistent with raw code") = test {
+ val pubx = q"val x: Int"
+ val privx = q"private[this] val x: Int"
+ assertEqAst(q" class C(x: Int)", " class C(x: Int) ")
+ assertEqAst(q"case class C(x: Int)", "case class C(x: Int) ")
+ assertEqAst(q" class C($pubx) ", " class C(val x: Int) ")
+ assertEqAst(q"case class C($pubx) ", "case class C(x: Int) ")
+ assertEqAst(q" class C($privx)", " class C(x: Int) ")
+ assertEqAst(q"case class C($privx)", "case class C(private[this] val x: Int)")
+ }
+}
+
+trait TraitConstruction { self: QuasiquoteProperties =>
+ property("splice name into trait def") = test {
+ val Foo = TypeName("Foo")
+ assert(q"trait $Foo" ≈ q"trait Foo")
+ }
+
+ property("splice type params into trait def") = test {
+ val tparams = q"type A" :: q"type B" :: Nil
+ assert(q"trait Foo[..$tparams]" ≈ q"trait Foo[A, B]")
+ }
+
+ property("splice defs into trait body") = test {
+ val body = q"def foo" :: q"val bar: Baz" :: Nil
+ assert(q"trait Foo { ..$body }" ≈ q"trait Foo { def foo; val bar: Baz }")
+ }
+
+ property("splice parents into trait") = test {
+ val parents = tq"A" :: tq"B" :: Nil
+ assert(q"trait Foo extends ..$parents" ≈ q"trait Foo extends A with B")
+ }
+
+ property("splice early valdef into trait") = test {
+ val x = q"val x: Int = 1"
+ assertEqAst(q"trait T extends { $x } with Any", "trait T extends { val x: Int = 1} with Any")
+ }
+
+ property("construct trait with early valdef") = test {
+ assertEqAst(q"trait T extends { val x: Int = 1 } with Any", "trait T extends { val x: Int = 1 } with Any")
+ }
+
+ property("splice defs into early block") = test {
+ val defs = q"val x: Int = 0" :: q"type Foo = Bar" :: Nil
+ assert(q"trait T extends { ..$defs } with Bippy" ≈
+ q"trait T extends { val x: Int = 0; type Foo = Bar} with Bippy")
+ }
+
+ property("fail on splicing of non-valid early tree") = test {
+ val defn = q"def x: Int = 0"
+ assertThrows[IllegalArgumentException] { q"trait T extends { $defn } with Bar" }
+ }
+}
+
+trait TypeDefConstruction { self: QuasiquoteProperties =>
+ property("splice type name into typedef") = forAll { (name1: TypeName, name2: TypeName) =>
+ q"type $name1 = $name2" ≈ TypeDef(Modifiers(), name1, List(), Ident(name2))
+ }
+
+ property("splice type names into type bounds") = forAll { (T1: TypeName, T2: TypeName, T3: TypeName) =>
+ q"type $T1 >: $T2 <: $T3" ≈
+ TypeDef(
+ Modifiers(DEFERRED), T1, List(),
+ TypeBoundsTree(Ident(T2), Ident(T3)))
+ }
+
+ property("splice trees names into type bounds") = forAll { (T: TypeName, t1: Tree, t2: Tree) =>
+ q"type $T >: $t1 <: $t2" ≈
+ TypeDef(
+ Modifiers(DEFERRED), T, List(),
+ TypeBoundsTree(t1, t2))
+ }
+
+ property("splice tparams into typedef (1)") = forAll { (T: TypeName, targs: List[TypeDef], t: Tree) =>
+ q"type $T[..$targs] = $t" ≈ TypeDef(Modifiers(), T, targs, t)
+ }
+
+ property("splice tparams into typedef (2)") = forAll { (T: TypeName, targs1: List[TypeDef], targs2: List[TypeDef], t: Tree) =>
+ q"type $T[..$targs1, ..$targs2] = $t" ≈ TypeDef(Modifiers(), T, targs1 ++ targs2, t)
+ }
+
+ property("splice tparams into typedef (3)") = forAll { (T: TypeName, targ: TypeDef, targs: List[TypeDef], t: Tree) =>
+ q"type $T[$targ, ..$targs] = $t" ≈ TypeDef(Modifiers(), T, targ :: targs, t)
+ }
+
+ property("splice typename into typedef with default bounds") = forAll { (T1: TypeName, T2: TypeName, t: Tree) =>
+ q"type $T1[$T2 >: Any <: Nothing] = $t" ≈
+ TypeDef(
+ Modifiers(), T1,
+ List(TypeDef(
+ Modifiers(PARAM), T2,
+ List(),
+ TypeBoundsTree(
+ Ident(TypeName("Any")),
+ Ident(TypeName("Nothing"))))),
+ t)
+ }
+
+ property("splice type names into compound type tree") = forAll { (T: TypeName, A: TypeName, B: TypeName) =>
+ q"type $T = $A with $B" ≈
+ TypeDef(
+ Modifiers(), T, List(),
+ CompoundTypeTree(
+ Template(List(Ident(A), Ident(B)), ValDef(Modifiers(PRIVATE), nme.WILDCARD, TypeTree(), EmptyTree), List())))
+ }
+
+ property("splice trees into existential type tree") = forAll {
+ (T1: TypeName, T2: TypeName, X: TypeName, Lo: TypeName, Hi: TypeName) =>
+
+ q"type $T1 = $T2[$X] forSome { type $X >: $Lo <: $Hi }" ≈
+ TypeDef(
+ Modifiers(), T1, List(),
+ ExistentialTypeTree(
+ AppliedTypeTree(Ident(T2), List(Ident(X))),
+ List(
+ TypeDef(Modifiers(DEFERRED), X, List(), TypeBoundsTree(Ident(Lo), Ident(Hi))))))
+ }
+
+ property("splice tree into singleton type tree") = forAll { (name: TypeName, t: Tree) =>
+ q"type $name = $t.type" ≈ q"type $name = ${SingletonTypeTree(t)}"
+ }
+
+ property("splice into applied type tree") = forAll { (T1: TypeName, T2: TypeName, args: List[Tree]) =>
+ q"type $T1 = $T2[..$args]" ≈
+ TypeDef(Modifiers(), T1, List(),
+ if(args.nonEmpty) AppliedTypeTree(Ident(T2), args) else Ident(T2))
+ }
+}
+
+trait ValDefConstruction { self: QuasiquoteProperties =>
+ property("splice term name into val") = forAll { (name: TermName, tpt: Tree, rhs: Tree) =>
+ q"val $name: $tpt = $rhs" ≈ ValDef(Modifiers(), name, tpt, rhs)
+ }
+
+ property("splice term name into var") = forAll { (name: TermName, tpt: Tree, rhs: Tree) =>
+ q"var $name: $tpt = $rhs" ≈ ValDef(Modifiers(MUTABLE), name, tpt, rhs)
+ }
+}
+
+trait MethodConstruction { self: QuasiquoteProperties =>
+ property("splice paramss into defdef") = test {
+ val paramss = List(q"val x: Int") :: List(q"val y: Int = 1") :: Nil
+ assert(q"def foo(...$paramss)" ≈ parse("def foo(x: Int)(y: Int = 1)"))
+ }
+
+ property("splice tparams into defdef") = test {
+ val tparams = q"type A" :: q"type B <: Bippy" :: Nil
+ assert(q"def foo[..$tparams]" ≈ parse("def foo[A, B <: Bippy]"))
+ }
+
+ def assertSameAnnots(tree: {def mods: Modifiers}, annots: List[Tree]) =
+ assert(tree.mods.annotations ≈ annots,
+ s"${tree.mods.annotations} =/= ${annots}")
+
+ def assertSameAnnots(tree1: {def mods: Modifiers}, tree2: {def mods: Modifiers}) =
+ assert(tree1.mods.annotations ≈ tree2.mods.annotations,
+ s"${tree1.mods.annotations} =/= ${tree2.mods.annotations}")
+
+ property("splice type name into annotation") = test {
+ val name = TypeName("annot")
+ assertSameAnnots(q"@$name def foo", List(annot(name)))
+ }
+
+ property("splice ident into annotation") = test {
+ val name = TypeName("annot")
+ val ident = Ident(name)
+ assertSameAnnots(q"@$ident def foo", List(annot(name)))
+ }
+
+ property("splice idents into annotation") = test {
+ val idents = List(Ident(TypeName("annot1")), Ident(TypeName("annot2")))
+ assertSameAnnots(q"@..$idents def foo",
+ idents.map { ident => Apply(Select(New(ident), nme.CONSTRUCTOR), List()) })
+ }
+
+ property("splice constructor calls into annotation") = test {
+ val ctorcalls = List(annot("a1"), annot("a2"))
+ assertSameAnnots(q"@..$ctorcalls def foo", ctorcalls)
+ }
+
+ property("splice multiple annotations (1)") = test {
+ val annot1 = annot("a1")
+ val annot2 = annot("a2")
+ val res = q"@$annot1 @$annot2 def foo"
+ assertSameAnnots(res, List(annot1, annot2))
+ }
+
+ property("splice multiple annotations (2)") = test {
+ val annot1 = annot("a1")
+ val annots = List(annot("a2"), annot("a3"))
+ val res = q"@$annot1 @..$annots def foo"
+ assertSameAnnots(res, annot1 :: annots)
+ }
+
+ property("splice annotations with arguments (1)") = test {
+ val a = annot("a", List(q"x"))
+ assertSameAnnots(q"@$a def foo", q"@a(x) def foo")
+ }
+
+ property("splice annotations with arguments (2)") = test {
+ val a = newTypeName("a")
+ assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo")
+ }
+
+ property("splice annotations with arguments (3") = test {
+ val a = Ident(newTypeName("a"))
+ assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo")
+ }
+
+ property("splice improper tree into annot") = test {
+ val t = tq"Foo[Baz]"
+ assertThrows[IllegalArgumentException] {
+ q"@$t def foo"
+ }
+ }
+
+ property("can't splice annotations with arguments specificed twice") = test {
+ val a = annot("a", List(q"x"))
+ assertThrows[IllegalArgumentException] {
+ q"@$a(y) def foo"
+ }
+ }
+
+ property("splice annotation with targs") = test {
+ val a = q"new Foo[A, B]"
+ assertEqAst(q"@$a def foo", "@Foo[A,B] def foo")
+ }
+
+ property("splice annotation with multiple argument lists") = test{
+ val a = q"new Foo(a)(b)"
+ assertEqAst(q"@$a def foo", "@Foo(a)(b) def foo")
+ }
+} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
new file mode 100644
index 0000000000..fdfbfe871c
--- /dev/null
+++ b/test/files/scalacheck/quasiquotes/DefinitionDeconstructionProps.scala
@@ -0,0 +1,147 @@
+import org.scalacheck._
+import Prop._
+import Gen._
+import Arbitrary._
+
+import scala.reflect.runtime.universe._
+import Flag._
+
+object DefinitionDeconstructionProps
+ extends QuasiquoteProperties("definition deconstruction")
+ with TraitDeconstruction
+ with ClassDeconstruction
+ with ObjectDeconstruction
+ with ModsDeconstruction
+ with ValVarDeconstruction
+
+trait TraitDeconstruction { self: QuasiquoteProperties =>
+ property("exhaustive trait matcher") = test {
+ def matches(line: String) {
+ val q"""$mods trait $name[..$targs]
+ extends { ..$early } with ..$parents { $self => ..$body }""" = parse(line)
+ }
+ matches("trait Foo")
+ matches("trait Foo[T]")
+ matches("trait Foo { def bar }")
+ matches("trait Foo extends Bar with Baz")
+ matches("trait Foo { self: Bippy => val x: Int = 1}")
+ matches("trait Foo extends { val early: Int = 1 } with Bar { val late = early }")
+ matches("private[Gap] trait Foo")
+ }
+}
+
+trait ObjectDeconstruction { self: QuasiquoteProperties =>
+ property("exhaustive object matcher") = test {
+ def matches(line: String) = {
+ val q"""$mods object $name extends { ..$early } with ..$parents { $self => ..$body }""" = parse(line)
+ }
+ matches("object Foo")
+ matches("object Foo extends Bar[T]")
+ matches("object Foo extends { val early: T = v } with Bar")
+ matches("object Foo extends Foo { selfy => body }")
+ matches("private[Bippy] object Foo extends Bar with Baz")
+ }
+}
+
+trait ClassDeconstruction { self: QuasiquoteProperties =>
+ property("class without params") = test {
+ val q"class $name { ..$body }" = q"class Foo { def bar = 3 }"
+ assert(body ≈ List(q"def bar = 3"))
+ }
+
+ property("class constructor") = test {
+ val q"class $name(...$argss)" = q"class Foo(x: Int)(y: Int)"
+ assert(argss.length == 2)
+ }
+
+ property("class parents") = test {
+ val q"class $name extends ..$parents" = q"class Foo extends Bar with Blah"
+ assert(parents ≈ List(tq"Bar", tq"Blah"))
+ }
+
+ property("class selfdef") = test {
+ val q"class $name { $self => }" = q"class Foo { self: T => }"
+ assert(self.name ≈ TermName("self") && self.tpt ≈ tq"T")
+ }
+
+ property("class tparams") = test {
+ val q"class $name[..$tparams]" = q"class Foo[A, B]"
+ assert(tparams.map { _.name } == List(TypeName("A"), TypeName("B")))
+ }
+
+ property("deconstruct bare case class") = test {
+ val q"$mods class $name(..$args) extends ..$parents" = q"case class Foo(x: Int)"
+ }
+
+ 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)
+ }
+ matches("class Foo")
+ matches("class Foo[T]")
+ matches("class Foo[T] @annot")
+ matches("class Foo extends Bar with Baz")
+ matches("class Foo { body }")
+ matches("class Foo extends { val early = 0 } with Any")
+ matches("abstract class Foo")
+ matches("private[Baz] class Foo")
+ matches("class Foo(first: A)(second: B)")
+ matches("class Foo(first: A) extends Bar(first) with Baz")
+ matches("class Foo private (first: A) { def bar }")
+ matches("class Foo { self => bar(self) }")
+ matches("case class Foo(x: Int)")
+ }
+}
+
+trait ModsDeconstruction { self: QuasiquoteProperties =>
+ property("deconstruct mods") = test {
+ val mods = Modifiers(IMPLICIT | PRIVATE, TermName("foobar"), Nil)
+ val q"$mods0 def foo" = q"$mods def foo"
+ assert(mods0 ≈ mods)
+ }
+
+ property("@$annot def foo") = forAll { (annotName: TypeName) =>
+ val q"@$annot def foo" = q"@$annotName def foo"
+ annot ≈ Apply(Select(New(Ident(annotName)), nme.CONSTRUCTOR), List())
+ }
+
+ property("@$annot(..$args) def foo") = forAll { (annotName: TypeName, tree: Tree) =>
+ val q"@$annot(..$args) def foo" = q"@$annotName($tree) def foo"
+ annot ≈ Ident(annotName) && args ≈ List(tree)
+ }
+
+ property("@..$annots def foo") = test {
+ val a = annot("a")
+ val b = annot("b")
+ val q"@..$annots def foo" = q"@$a @$b def foo"
+ annots ≈ List(a, b)
+ }
+
+ property("@$annot @..$annots def foo") = test {
+ val a = annot("a")
+ val b = annot("b")
+ val c = annot("c")
+ val q"@$first @..$rest def foo" = q"@$a @$b @$c def foo"
+ first ≈ a && rest ≈ List(b, c)
+ }
+}
+
+trait ValVarDeconstruction { self: QuasiquoteProperties =>
+ property("exhaustive val matcher") = test {
+ def matches(line: String) { val q"$mods val $name: $tpt = $rhs" = parse(line) }
+ matches("val x: Int")
+ matches("val x: Int = 1")
+ matches("lazy val x: Int = 1")
+ matches("implicit val x = 1")
+ assertThrows[MatchError] { matches("var x = 1") }
+ }
+
+ property("exhaustive var matcher") = test {
+ def matches(line: String) { val q"$mods var $name: $tpt = $rhs" = parse(line) }
+ matches("var x: Int")
+ matches("var x: Int = 1")
+ matches("var x = 1")
+ assertThrows[MatchError] { matches("val x = 1") }
+ }
+} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
index aee50c9c5f..504cb2a77d 100644
--- a/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/PatternConstructionProps.scala
@@ -32,6 +32,6 @@ object PatternConstructionProps extends QuasiquoteProperties("pattern constructi
}
property("splice into casedef") = forAll { (pat: Tree, cond: Tree, body: Tree) =>
- cq"$pat if $cond => $body" ≈ CaseDef(pat, cond, Block(List(), body))
+ cq"$pat if $cond => $body" ≈ CaseDef(pat, cond, body)
}
} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
index 5e87aa57cc..6a531071bf 100644
--- a/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
+++ b/test/files/scalacheck/quasiquotes/QuasiquoteProperties.scala
@@ -1,7 +1,10 @@
import scala.reflect.runtime.universe._
-import scala.tools.reflect.ToolBox
-import scala.tools.reflect.ToolBoxError
+import scala.reflect.runtime.universe.definitions._
+import scala.reflect.runtime.universe.Flag._
+import scala.reflect.runtime.currentMirror
+import scala.reflect.api.{Liftable, Universe}
import scala.reflect.macros.TypecheckException
+import scala.tools.reflect.{ToolBox, ToolBoxError}
import org.scalacheck._
import Prop._
@@ -57,6 +60,14 @@ trait Helpers {
assert(false, "exception wasn't thrown")
}
+ def assertEqAst(tree: Tree, code: String) = assert(eqAst(tree, code))
+ def eqAst(tree: Tree, code: String) = tree ≈ parse(code)
+
+ val toolbox = currentMirror.mkToolBox()
+ val parse = toolbox.parse(_)
+ val compile = toolbox.compile(_)
+ val eval = toolbox.eval(_)
+
def fails(msg: String, block: String) = {
def result(ok: Boolean, description: String = "") = {
val status = if (ok) Prop.Proof else Prop.False
@@ -64,14 +75,12 @@ trait Helpers {
Prop { new Prop.Result(status, Nil, Set.empty, labels) }
}
try {
- val tb = rootMirror.mkToolBox()
- val tree = tb.parse(s"""
+ compile(parse(s"""
object Wrapper extends Helpers {
import scala.reflect.runtime.universe._
$block
}
- """)
- tb.compile(tree)
+ """))
result(false, "given code doesn't fail to typecheck")
} catch {
case ToolBoxError(emsg, _) =>
diff --git a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
index b14945f24b..c6cca85c81 100644
--- a/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermConstructionProps.scala
@@ -7,16 +7,6 @@ import scala.reflect.runtime.universe._
import Flag._
object TermConstructionProps extends QuasiquoteProperties("term construction") {
- val anyRef = Select(Ident(TermName("scala")), TypeName("AnyRef"))
- val emtpyConstructor =
- DefDef(
- Modifiers(), nme.CONSTRUCTOR, List(),
- List(List()), TypeTree(), Block(List(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List())), Literal(Constant(()))))
-
- def classWithMethods(name: TypeName, methods: List[DefDef] = Nil) =
- ClassDef(
- Modifiers(), name, List(),
- Template(List(anyRef), emptyValDef, List(emtpyConstructor) ++ methods))
property("splice single tree return tree itself") = forAll { (t: Tree) =>
q"$t" ≈ t
@@ -26,22 +16,6 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
q"if($t1) $t2 else $t3" ≈ If(t1, t2, t3)
}
- property("splice term name into val") = forAll { (name: TermName) =>
- q"val $name = 0" ≈ ValDef(Modifiers(), name, TypeTree(), Literal(Constant(0)))
- }
-
- property("splice type name into typedef") = forAll { (name1: TypeName, name2: TypeName) =>
- q"type $name1 = $name2" ≈ TypeDef(Modifiers(), name1, List(), Ident(name2))
- }
-
- property("splice term name into class") = forAll { (name: TypeName) =>
- q"class $name" ≈ classWithMethods(name)
- }
-
- property("splice method into class") = forAll { (name: TypeName, method: DefDef) =>
- q"class $name { $method }" ≈ classWithMethods(name, List(method))
- }
-
property("splice trees into ascriptiopn") = forAll { (t1: Tree, t2: Tree) =>
q"$t1 : $t2" ≈ Typed(t1, t2)
}
@@ -69,19 +43,13 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
}
property("splice trees into block") = forAll { (t1: Tree, t2: Tree, t3: Tree) =>
- q"""{
+ blockInvariant(q"""{
$t1
$t2
$t3
- }""" ≈ Block(List(t1, t2), t3)
+ }""", List(t1, t2, t3))
}
- property("splice type name into class parents") = forAll { (name: TypeName, parent: TypeName) =>
- q"class $name extends $parent" ≈
- ClassDef(
- Modifiers(), name, List(),
- Template(List(Ident(parent)), emptyValDef, List(emtpyConstructor)))
- }
property("splice tree into new") = forAll { (tree: Tree) =>
q"new $tree" ≈ Apply(Select(New(tree), nme.CONSTRUCTOR), List())
@@ -101,13 +69,6 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
q"$fun($arg1, $arg2, ..$args)" ≈ Apply(fun, List(arg1) ++ List(arg2) ++ args)
}
- property("splice members into class") = forAll { (name: TypeName, defs: List[DefDef], extra: DefDef) =>
- q"""class $name {
- ..$defs
- $extra
- }""" ≈ classWithMethods(name, defs ++ List(extra))
- }
-
property("splice into new") = forAll { (name: TypeName, body: List[Tree]) =>
q"new $name { ..$body }" ≈
q"""{
@@ -118,11 +79,6 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
}"""
}
-
- property("splice tree into singleton type tree") = forAll { (name: TypeName, t: Tree) =>
- q"type $name = $t.type" ≈ q"type $name = ${SingletonTypeTree(t)}"
- }
-
property("splice type name into this") = forAll { (T: TypeName) =>
q"$T.this" ≈ This(T)
}
@@ -132,66 +88,7 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
}
property("splice trees into type apply") = forAll { (fun: TreeIsTerm, types: List[Tree]) =>
- q"$fun[..$types]" ≈ TypeApply(fun, types)
- }
-
- property("splice type names into type bounds") = forAll { (T1: TypeName, T2: TypeName, T3: TypeName) =>
- q"type $T1 >: $T2 <: $T3" ≈
- TypeDef(
- Modifiers(DEFERRED), T1, List(),
- TypeBoundsTree(Ident(T2), Ident(T3)))
- }
-
- property("splice trees names into type bounds") = forAll { (T: TypeName, t1: Tree, t2: Tree) =>
- q"type $T >: $t1 <: $t2" ≈
- TypeDef(
- Modifiers(DEFERRED), T, List(),
- TypeBoundsTree(t1, t2))
- }
-
- property("splice tparams into typedef (1)") = forAll { (T: TypeName, targs: List[TypeDef], t: Tree) =>
- q"type $T[..$targs] = $t" ≈ TypeDef(Modifiers(), T, targs, t)
- }
-
- property("splice tparams into typedef (2)") = forAll { (T: TypeName, targs1: List[TypeDef], targs2: List[TypeDef], t: Tree) =>
- q"type $T[..$targs1, ..$targs2] = $t" ≈ TypeDef(Modifiers(), T, targs1 ++ targs2, t)
- }
-
- property("splice tparams into typedef (3)") = forAll { (T: TypeName, targ: TypeDef, targs: List[TypeDef], t: Tree) =>
- q"type $T[$targ, ..$targs] = $t" ≈ TypeDef(Modifiers(), T, targ :: targs, t)
- }
-
- property("splice typename into typedef with default bounds") = forAll { (T1: TypeName, T2: TypeName, t: Tree) =>
- q"type $T1[$T2 >: Any <: Nothing] = $t" ≈
- TypeDef(
- Modifiers(), T1,
- List(TypeDef(
- Modifiers(PARAM), T2,
- List(),
- TypeBoundsTree(
- Ident(TypeName("Any")),
- Ident(TypeName("Nothing"))))),
- t)
- }
-
- property("splice type names into compound type tree") = forAll { (T: TypeName, A: TypeName, B: TypeName) =>
- q"type $T = $A with $B" ≈
- TypeDef(
- Modifiers(), T, List(),
- CompoundTypeTree(
- Template(List(Ident(A), Ident(B)), ValDef(Modifiers(PRIVATE), nme.WILDCARD, TypeTree(), EmptyTree), List())))
- }
-
- property("splice trees into existential type tree") = forAll {
- (T1: TypeName, T2: TypeName, X: TypeName, Lo: TypeName, Hi: TypeName) =>
-
- q"type $T1 = $T2[$X] forSome { type $X >: $Lo <: $Hi }" ≈
- TypeDef(
- Modifiers(), T1, List(),
- ExistentialTypeTree(
- AppliedTypeTree(Ident(T2), List(Ident(X))),
- List(
- TypeDef(Modifiers(DEFERRED), X, List(), TypeBoundsTree(Ident(Lo), Ident(Hi))))))
+ q"$fun[..$types]" ≈ (if (types.nonEmpty) TypeApply(fun, types) else fun)
}
property("splice names into import selector") = forAll {
@@ -223,95 +120,24 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
CaseDef(Alternative(List(A, B)), EmptyTree, Literal(Constant(())))))
}
- property("splice into applied type tree") = forAll { (T1: TypeName, T2: TypeName, args: List[Tree]) =>
- q"type $T1 = $T2[..$args]" ≈
- TypeDef(
- Modifiers(), T1, List(),
- AppliedTypeTree(Ident(T2), args))
- }
+ def blockInvariant(quote: Tree, trees: List[Tree]) =
+ quote ≈ (trees match {
+ case Nil => q"()"
+ case _ :+ last if !last.isTerm => Block(trees, q"()")
+ case head :: Nil => head
+ case init :+ last => Block(init, last)
+ })
property("splice list of trees into block (1)") = forAll { (trees: List[Tree]) =>
- q"{ ..$trees }" ≈ (trees match {
- case Nil => Block(Nil, q"()")
- case _ => Block(trees.init, trees.last)
- })
+ blockInvariant(q"{ ..$trees }", trees)
}
property("splice list of trees into block (2)") = forAll { (trees1: List[Tree], trees2: List[Tree]) =>
- q"{ ..$trees1 ; ..$trees2 }" ≈ ((trees1 ++ trees2) match {
- case Nil => Block(Nil, Literal(Constant(())))
- case trees => Block(trees.init, trees.last)
- })
+ blockInvariant(q"{ ..$trees1 ; ..$trees2 }", trees1 ++ trees2)
}
property("splice list of trees into block (3)") = forAll { (trees: List[Tree], tree: Tree) =>
- q"{ ..$trees; $tree }" ≈ Block(trees, tree)
- }
-
- def assertSameAnnots(tree: {def mods: Modifiers}, annots: List[Tree]) =
- assert(tree.mods.annotations ≈ annots,
- s"${tree.mods.annotations} =/= ${annots}")
-
- def assertSameAnnots(tree1: {def mods: Modifiers}, tree2: {def mods: Modifiers}) =
- assert(tree1.mods.annotations ≈ tree2.mods.annotations,
- s"${tree1.mods.annotations} =/= ${tree2.mods.annotations}")
-
- property("splice type name into annotation") = test {
- val name = TypeName("annot")
- assertSameAnnots(q"@$name def foo", List(annot(name)))
- }
-
- property("splice ident into annotation") = test {
- val name = TypeName("annot")
- val ident = Ident(name)
- assertSameAnnots(q"@$ident def foo", List(annot(name)))
- }
-
- property("splice idents into annotation") = test {
- val idents = List(Ident(TypeName("annot1")), Ident(TypeName("annot2")))
- assertSameAnnots(q"@..$idents def foo",
- idents.map { ident => Apply(Select(New(ident), nme.CONSTRUCTOR), List()) })
- }
-
- property("splice constructor calls into annotation") = test {
- val ctorcalls = List(annot("a1"), annot("a2"))
- assertSameAnnots(q"@..$ctorcalls def foo", ctorcalls)
- }
-
- property("splice multiple annotations (1)") = test {
- val annot1 = annot("a1")
- val annot2 = annot("a2")
- val res = q"@$annot1 @$annot2 def foo"
- assertSameAnnots(res, List(annot1, annot2))
- }
-
- property("splice multiple annotations (2)") = test {
- val annot1 = annot("a1")
- val annots = List(annot("a2"), annot("a3"))
- val res = q"@$annot1 @..$annots def foo"
- assertSameAnnots(res, annot1 :: annots)
- }
-
- property("splice annotations with arguments (1)") = test {
- val a = annot("a", List(q"x"))
- assertSameAnnots(q"@$a def foo", q"@a(x) def foo")
- }
-
- property("splice annotations with arguments (2)") = test {
- val a = newTypeName("a")
- assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo")
- }
-
- property("splice annotations with arguments (3") = test {
- val a = Ident(newTypeName("a"))
- assertSameAnnots(q"@$a(x) def foo", q"@a(x) def foo")
- }
-
- property("can't splice annotations with arguments specificed twice") = test {
- val a = annot("a", List(q"x"))
- assertThrows[IllegalArgumentException] {
- q"@$a(y) def foo"
- }
+ blockInvariant(q"{ ..$trees; $tree }", trees :+ tree)
}
property("splice term into brackets") = test {
@@ -332,10 +158,13 @@ object TermConstructionProps extends QuasiquoteProperties("term construction") {
assert(q"(..$empty)" ≈ q"()")
}
- property("splice improper tree into annot") = test {
- val t = tq"Foo[Baz]"
- assertThrows[IllegalArgumentException] {
- q"@$t def foo"
- }
+ property("function param flags are the same") = test {
+ val xy = q"val x: A" :: q"val y: B" :: Nil
+ assertEqAst(q"(..$xy) => x + y", "(x: A, y: B) => x + y")
+ }
+
+ property("anonymous functions don't support default values") = test {
+ val x = q"val x: Int = 1"
+ assertThrows[IllegalArgumentException] { q"($x) => x" }
}
}
diff --git a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
index 114c9f112b..45c7ee4bb7 100644
--- a/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TermDeconstructionProps.scala
@@ -7,7 +7,6 @@ import scala.reflect.runtime.universe._
import Flag._
object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction") {
-
property("f(..x) = f") = test {
assertThrows[MatchError] {
val q"f(..$argss)" = q"f"
@@ -44,56 +43,6 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
argss ≈ List()
}
- property("@$annot def foo") = forAll { (annotName: TypeName) =>
- val q"@$annot def foo" = q"@$annotName def foo"
- annot ≈ Apply(Select(New(Ident(annotName)), nme.CONSTRUCTOR), List())
- }
-
- property("@$annot(..$args) def foo") = forAll { (annotName: TypeName, tree: Tree) =>
- val q"@$annot(..$args) def foo" = q"@$annotName($tree) def foo"
- annot ≈ Ident(annotName) && args ≈ List(tree)
- }
-
- property("@..$annots def foo") = test {
- val a = annot("a")
- val b = annot("b")
- val q"@..$annots def foo" = q"@$a @$b def foo"
- annots ≈ List(a, b)
- }
-
- property("@$annot @..$annots def foo") = test {
- val a = annot("a")
- val b = annot("b")
- val c = annot("c")
- val q"@$first @..$rest def foo" = q"@$a @$b @$c def foo"
- first ≈ a && rest ≈ List(b, c)
- }
-
- property("class without params") = test {
- val q"class $name { ..$body }" = q"class Foo { def bar = 3 }"
- assert(body ≈ List(q"def bar = 3"))
- }
-
- property("class constructor") = test {
- val q"class $name(...$argss)" = q"class Foo(x: Int)(y: Int)"
- assert(argss.length == 2)
- }
-
- property("class parents") = test {
- val q"class $name extends ..$parents" = q"class Foo extends Bar with Blah"
- assert(parents ≈ List(tq"Bar", tq"Blah"))
- }
-
- property("class selfdef") = test {
- val q"class $name { $self => }" = q"class Foo { self: T => }"
- assert(self.name ≈ TermName("self") && self.tpt ≈ tq"T")
- }
-
- property("class tparams") = test {
- val q"class $name[..$tparams]" = q"class Foo[A, B]"
- assert(tparams.map { _.name } == List(TypeName("A"), TypeName("B")))
- }
-
property("deconstruct unit as tuple") = test {
val q"(..$xs)" = q"()"
assert(xs.isEmpty)
@@ -114,9 +63,32 @@ object TermDeconstructionProps extends QuasiquoteProperties("term deconstruction
x ≈ q"x" && cases ≈ List(cq"1 =>", cq"2 =>")
}
- property("deconstruct mods") = test {
- val mods = Modifiers(IMPLICIT | PRIVATE, TermName("foobar"), Nil)
- val q"$mods0 def foo" = q"$mods def foo"
- assert(mods0 ≈ mods)
+ property("deconstruct block") = test {
+ val q"{ ..$xs }" = q"{ x1; x2; x3 }"
+ assert(xs ≈ List(q"x1", q"x2", q"x3"))
+ }
+
+ property("exhaustive function matcher") = test {
+ def matches(line: String) { val q"(..$args) => $body" = parse(line) }
+ matches("() => bippy")
+ matches("(y: Y) => y oh y")
+ matches("(x: X, y: Y) => x and y")
}
-} \ No newline at end of file
+
+ property("exhaustive new pattern") = test {
+ def matches(line: String) {
+ val q"new { ..$early } with $name[..$targs](...$vargss) with ..$mixin { $self => ..$body }" = parse(line)
+ }
+ matches("new foo")
+ matches("new foo { body }")
+ matches("new foo[t]")
+ matches("new foo(x)")
+ matches("new foo[t](x)")
+ matches("new foo[t](x) { body }")
+ matches("new foo with bar")
+ matches("new foo with bar { body }")
+ matches("new { anonymous }")
+ matches("new { val early = 1} with Parent[Int] { body }")
+ matches("new Foo { selfie => }")
+ }
+}
diff --git a/test/files/scalacheck/quasiquotes/Test.scala b/test/files/scalacheck/quasiquotes/Test.scala
index 2387a9b008..05097711ef 100644
--- a/test/files/scalacheck/quasiquotes/Test.scala
+++ b/test/files/scalacheck/quasiquotes/Test.scala
@@ -9,4 +9,6 @@ object Test extends Properties("quasiquotes") {
include(PatternDeconstructionProps)
include(LiftableProps)
include(ErrorProps)
+ include(DefinitionConstructionProps)
+ include(DefinitionDeconstructionProps)
} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
index 535ed8ecbf..cac83ff8ac 100644
--- a/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeConstructionProps.scala
@@ -22,4 +22,15 @@ object TypeConstructionProps extends QuasiquoteProperties("type construction")
assert(tq"(..$ts)" ≈ tq"Tuple2[t1, t2]")
assert(tq"(t0, ..$ts)" ≈ tq"Tuple3[t0, t1, t2]")
}
+
+ property("refined type") = test {
+ val stats = q"def foo" :: q"val x: Int" :: q"type Y = String" :: Nil
+ assert(tq"T { ..$stats }" ≈ tq"T { def foo; val x: Int; type Y = String }")
+ }
+
+ property("function type") = test {
+ val argtpes = tq"A" :: tq"B" :: Nil
+ val restpe = tq"C"
+ assert(tq"..$argtpes => $restpe" ≈ tq"(A, B) => C")
+ }
} \ No newline at end of file
diff --git a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
index 6ab699d4f0..e1d5f4df96 100644
--- a/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
+++ b/test/files/scalacheck/quasiquotes/TypeDeconstructionProps.scala
@@ -19,11 +19,22 @@ object TypeDeconstructionProps extends QuasiquoteProperties("type deconstruction
}
property("tuple type") = test {
- val tq"(..$empty)" = tq"scala.Unit"
+ val tq"(..$empty)" = tq"_root_.scala.Unit"
assert(empty.isEmpty)
val tq"(..$ts)" = tq"(t1, t2)"
assert(ts ≈ List(tq"t1", tq"t2"))
val tq"($head, ..$tail)" = tq"(t0, t1, t2)"
assert(head ≈ tq"t0" && tail ≈ List(tq"t1", tq"t2"))
}
+
+ property("refined type") = test {
+ val tq"T { ..$stats }" = tq"T { def foo; val x: Int; type Y = String }"
+ assert(stats ≈ (q"def foo" :: q"val x: Int" :: q"type Y = String" :: Nil))
+ }
+
+ property("function type") = test {
+ val tq"..$argtpes => $restpe" = tq"(A, B) => C"
+ assert(argtpes ≈ (tq"A" :: tq"B" :: Nil))
+ assert(restpe ≈ tq"C")
+ }
} \ No newline at end of file
diff --git a/test/junit/scala/tools/nsc/util/StackTraceTest.scala b/test/junit/scala/tools/nsc/util/StackTraceTest.scala
new file mode 100644
index 0000000000..e7654244c5
--- /dev/null
+++ b/test/junit/scala/tools/nsc/util/StackTraceTest.scala
@@ -0,0 +1,159 @@
+
+package scala.tools.nsc.util
+
+import scala.language.reflectiveCalls
+import scala.util._
+import PartialFunction.cond
+import Properties.isJavaAtLeast
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+trait Expecting {
+ /*
+ import org.expecty.Expecty
+ final val expect = new Expecty
+ */
+}
+
+
+@RunWith(classOf[JUnit4])
+class StackTraceTest extends Expecting {
+ // formerly an enum
+ val CausedBy = "Caused by: "
+ val Suppressed = "Suppressed: "
+
+ // throws
+ def sample = throw new RuntimeException("Point of failure")
+ def sampler: String = sample
+
+ // repackage with message
+ def resample: String = try { sample } catch { case e: Throwable => throw new RuntimeException("resample", e) }
+ def resampler: String = resample
+
+ // simple wrapper
+ def wrapper: String = try { sample } catch { case e: Throwable => throw new RuntimeException(e) }
+ // another onion skin
+ def rewrapper: String = try { wrapper } catch { case e: Throwable => throw new RuntimeException(e) }
+ def rewrapperer: String = rewrapper
+
+ // only an insane wretch would do this
+ def insane: String = try { sample } catch {
+ case e: Throwable =>
+ val t = new RuntimeException(e)
+ e initCause t
+ throw t
+ }
+ def insaner: String = insane
+
+ /** Java 7 */
+ val suppressable = isJavaAtLeast("1.7")
+ type Suppressing = { def addSuppressed(t: Throwable): Unit }
+
+ def repressed: String = try { sample } catch {
+ case e: Throwable =>
+ val t = new RuntimeException("My problem")
+ if (suppressable) {
+ t.asInstanceOf[Suppressing] addSuppressed e
+ }
+ throw t
+ }
+ def represser: String = repressed
+
+ // evaluating s should throw, p trims stack trace, t is the test of resulting trace string
+ def probe(s: =>String)(p: StackTraceElement => Boolean)(t: String => Unit): Unit = {
+ Try(s) recover { case e => e stackTracePrefixString p } match {
+ case Success(s) => t(s)
+ case Failure(e) => throw e
+ }
+ }
+
+ @Test def showsAllTrace() {
+ probe(sampler)(_ => true) { s =>
+ val res = s.lines.toList
+ /*
+ expect {
+ res.length > 5 // many lines
+ // these expectations may be framework-specific
+ //s contains "sbt.TestFramework"
+ //res.last contains "java.lang.Thread"
+ }
+ */
+ assert (res.length > 5)
+ }
+ }
+ @Test def showsOnlyPrefix() = probe(sample)(_.getMethodName == "sample") { s =>
+ val res = s.lines.toList
+ /*
+ expect {
+ res.length == 3 // summary + one frame + elision
+ }
+ */
+ assert (res.length == 3)
+ }
+ @Test def showsCause() = probe(resampler)(_.getMethodName != "resampler") { s =>
+ val res = s.lines.toList
+ /*
+ expect {
+ res.length == 6 // summary + one frame + elision, caused by + one frame + elision
+ res exists (_ startsWith CausedBy.toString)
+ }
+ */
+ assert (res.length == 6)
+ assert (res exists (_ startsWith CausedBy.toString))
+ }
+ @Test def showsWrappedExceptions() = probe(rewrapperer)(_.getMethodName != "rewrapperer") { s =>
+ val res = s.lines.toList
+ /*
+ expect {
+ res.length == 9 // summary + one frame + elision times three
+ res exists (_ startsWith CausedBy.toString)
+ (res collect {
+ case s if s startsWith CausedBy.toString => s
+ }).size == 2
+ }
+ */
+ assert (res.length == 9)
+ assert (res exists (_ startsWith CausedBy.toString))
+ assert ((res collect {
+ case s if s startsWith CausedBy.toString => s
+ }).size == 2)
+ }
+ @Test def dontBlowOnCycle() = probe(insaner)(_.getMethodName != "insaner") { s =>
+ val res = s.lines.toList
+ /*
+ expect {
+ res.length == 7 // summary + one frame + elision times two with extra frame
+ res exists (_ startsWith CausedBy.toString)
+ }
+ */
+ assert (res.length == 7)
+ assert (res exists (_ startsWith CausedBy.toString))
+ }
+
+ /** Java 7, but shouldn't bomb on Java 6.
+ *
+java.lang.RuntimeException: My problem
+ at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:56)
+ ... 27 elided
+ Suppressed: java.lang.RuntimeException: Point of failure
+ at scala.tools.nsc.util.StackTraceTest.sample(StackTraceTest.scala:29)
+ at scala.tools.nsc.util.StackTraceTest.repressed(StackTraceTest.scala:54)
+ ... 27 more
+ */
+ @Test def showsSuppressed() = probe(represser)(_.getMethodName != "represser") { s =>
+ val res = s.lines.toList
+ if (suppressable) {
+ assert (res.length == 7)
+ assert (res exists (_.trim startsWith Suppressed.toString))
+ }
+ /*
+ expect {
+ res.length == 7
+ res exists (_ startsWith " " + Suppressed.toString)
+ }
+ */
+ }
+}
diff --git a/test/pending/pos/t7778/Foo_1.java b/test/pending/pos/t7778/Foo_1.java
new file mode 100644
index 0000000000..65431ffd46
--- /dev/null
+++ b/test/pending/pos/t7778/Foo_1.java
@@ -0,0 +1,6 @@
+import java.util.concurrent.Callable;
+
+public abstract class Foo_1<T> implements Callable<Foo_1<Object>.Inner> {
+ public abstract class Inner {
+ }
+}
diff --git a/test/pending/pos/t7778/Test_2.scala b/test/pending/pos/t7778/Test_2.scala
new file mode 100644
index 0000000000..306303a99e
--- /dev/null
+++ b/test/pending/pos/t7778/Test_2.scala
@@ -0,0 +1,3 @@
+class Test {
+ null: Foo_1[_]
+}
diff --git a/test/pending/pos/treecheckers.flags b/test/pending/pos/treecheckers.flags
new file mode 100644
index 0000000000..5319681590
--- /dev/null
+++ b/test/pending/pos/treecheckers.flags
@@ -0,0 +1 @@
+-Ycheck:all \ No newline at end of file
diff --git a/test/pending/pos/treecheckers/c1.scala b/test/pending/pos/treecheckers/c1.scala
new file mode 100644
index 0000000000..b936839039
--- /dev/null
+++ b/test/pending/pos/treecheckers/c1.scala
@@ -0,0 +1,12 @@
+object Test1 {
+ def f[T](xs: Array[T]): Array[T] = xs match { case xs => xs }
+ // [check: patmat] The symbol, tpe or info of tree `(x) : Array[T]` refers to a out-of-scope symbol, type T. tree.symbol.ownerChain: value x
+ // [check: patmat] The symbol, tpe or info of tree `(x) : Array[T]` refers to a out-of-scope symbol, type T. tree.symbol.ownerChain: value x
+
+ def g[T](xs: Array[T]): Array[T] = {
+ val x1: Array[T] = xs
+ def case4() = matchEnd3(x1)
+ def matchEnd3(x: Array[T]) = x
+ case4()
+ }
+}
diff --git a/test/pending/pos/treecheckers/c2.scala b/test/pending/pos/treecheckers/c2.scala
new file mode 100644
index 0000000000..c893a5c922
--- /dev/null
+++ b/test/pending/pos/treecheckers/c2.scala
@@ -0,0 +1 @@
+class Test2(val valueVal: Int) extends AnyVal
diff --git a/test/pending/pos/treecheckers/c3.scala b/test/pending/pos/treecheckers/c3.scala
new file mode 100644
index 0000000000..e480bbfb08
--- /dev/null
+++ b/test/pending/pos/treecheckers/c3.scala
@@ -0,0 +1,8 @@
+import scala.collection.mutable.ArrayOps
+
+object Test3 {
+ implicit def genericArrayOps[T](xs: Array[T]): ArrayOps[T] = (xs match {
+ case x: Array[AnyRef] => refArrayOps[AnyRef](x)
+ case x: Array[Boolean] => booleanArrayOps(x)
+ }).asInstanceOf[ArrayOps[T]]
+}
diff --git a/test/pending/pos/treecheckers/c4.scala b/test/pending/pos/treecheckers/c4.scala
new file mode 100644
index 0000000000..2328131770
--- /dev/null
+++ b/test/pending/pos/treecheckers/c4.scala
@@ -0,0 +1,9 @@
+sealed trait Message[+A]
+class Script[A] extends Message[A] {
+ def iterator: Iterator[Message[A]] = ???
+}
+
+trait Test4[A] {
+ def f(cmd: Message[A]): Iterator[A] = cmd match { case s: Script[t] => s.iterator flatMap f }
+ def g(cmd: Message[A]) = cmd match { case s: Script[t] => s }
+}
diff --git a/test/pending/pos/treecheckers/c5.scala b/test/pending/pos/treecheckers/c5.scala
new file mode 100644
index 0000000000..43cbb65d74
--- /dev/null
+++ b/test/pending/pos/treecheckers/c5.scala
@@ -0,0 +1,3 @@
+trait Factory[CC[X] <: Traversable[X]]
+
+object Test5 extends Factory[Traversable]
diff --git a/test/pending/pos/treecheckers/c6.scala b/test/pending/pos/treecheckers/c6.scala
new file mode 100644
index 0000000000..8283655f3a
--- /dev/null
+++ b/test/pending/pos/treecheckers/c6.scala
@@ -0,0 +1,4 @@
+object Test6 {
+ import scala.reflect.ClassTag
+ def f[T: ClassTag] = implicitly[ClassTag[T]].runtimeClass match { case x => x }
+}
diff --git a/test/files/jvm/backendBugUnapply.check b/test/pending/run/t7733.check
index 9d1e7b29c2..19765bd501 100644
--- a/test/files/jvm/backendBugUnapply.check
+++ b/test/pending/run/t7733.check
@@ -1,2 +1 @@
-baz
null
diff --git a/test/pending/run/t7733/Separate_1.scala b/test/pending/run/t7733/Separate_1.scala
new file mode 100644
index 0000000000..a326ecd53e
--- /dev/null
+++ b/test/pending/run/t7733/Separate_1.scala
@@ -0,0 +1,5 @@
+package test
+
+class Separate {
+ for (i <- 1 to 10) println(i)
+} \ No newline at end of file
diff --git a/test/pending/run/t7733/Test_2.scala b/test/pending/run/t7733/Test_2.scala
new file mode 100644
index 0000000000..28358574ec
--- /dev/null
+++ b/test/pending/run/t7733/Test_2.scala
@@ -0,0 +1,9 @@
+import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.ToolBox
+
+object Test extends App {
+ val tb = cm.mkToolBox()
+ val code = tb.parse("{ val x: test.Separate$$anonfun$1 = null; x }")
+ println(tb.eval(code))
+} \ No newline at end of file