summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/instrumented/InstrumentationTest.check4
-rw-r--r--test/files/instrumented/InstrumentationTest.scala27
-rw-r--r--test/files/instrumented/inline-in-constructors.check4
-rw-r--r--test/files/instrumented/inline-in-constructors/test_3.scala21
-rwxr-xr-xtest/files/neg/t6446-missing.check2
-rw-r--r--test/files/neg/t712.check1
-rw-r--r--test/files/pos/t6780.scala20
-rw-r--r--test/files/pos/t8060.scala11
-rw-r--r--test/files/presentation/scope-completion-2.check16
-rw-r--r--test/files/presentation/scope-completion-2/src/Completions.scala16
-rw-r--r--test/files/presentation/scope-completion-3.check16
-rw-r--r--test/files/presentation/scope-completion-import.check114
-rw-r--r--test/files/presentation/scope-completion-import/src/Completions.scala8
-rw-r--r--test/files/run/t4841-isolate-plugins.check2
-rw-r--r--test/files/run/t4841-isolate-plugins/ploogin.scala30
-rw-r--r--test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala39
-rw-r--r--test/files/run/t4841-no-plugin.check1
-rw-r--r--test/files/run/t4841-no-plugin.scala17
-rw-r--r--test/files/run/t7912.scala16
-rw-r--r--test/files/run/t8010.scala22
-rw-r--r--test/files/run/t8029.scala57
-rw-r--r--test/junit/scala/reflect/internal/util/StringOpsTest.scala52
22 files changed, 418 insertions, 78 deletions
diff --git a/test/files/instrumented/InstrumentationTest.check b/test/files/instrumented/InstrumentationTest.check
index 0c570fa12c..c82d16bd34 100644
--- a/test/files/instrumented/InstrumentationTest.check
+++ b/test/files/instrumented/InstrumentationTest.check
@@ -1,3 +1,4 @@
+#partest !avian
true
Method call statistics:
1 Foo1.<init>()V
@@ -8,3 +9,6 @@ Method call statistics:
1 scala/Predef$.println(Ljava/lang/Object;)V
1 scala/io/AnsiColor$class.$init$(Lscala/io/AnsiColor;)V
1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean;
+#partest avian
+!!!TEST SKIPPED!!!
+Instrumentation is not supported on Avian.
diff --git a/test/files/instrumented/InstrumentationTest.scala b/test/files/instrumented/InstrumentationTest.scala
index 0e53f80857..458fd4974b 100644
--- a/test/files/instrumented/InstrumentationTest.scala
+++ b/test/files/instrumented/InstrumentationTest.scala
@@ -15,16 +15,21 @@ package instrumented {
/** Tests if instrumentation itself works correctly */
object Test {
def main(args: Array[String]) {
- // force predef initialization before profiling
- Predef
- startProfiling()
- val foo1 = new Foo1
- foo1.someMethod
- val foo2 = new instrumented.Foo2
- foo2.someMethod
- // should box the boolean
- println(true)
- stopProfiling()
- printStatistics()
+ if (scala.tools.partest.utils.Properties.isAvian) {
+ println("!!!TEST SKIPPED!!!")
+ println("Instrumentation is not supported on Avian.")
+ } else {
+ // force predef initialization before profiling
+ Predef
+ startProfiling()
+ val foo1 = new Foo1
+ foo1.someMethod
+ val foo2 = new instrumented.Foo2
+ foo2.someMethod
+ // should box the boolean
+ println(true)
+ stopProfiling()
+ printStatistics()
+ }
}
}
diff --git a/test/files/instrumented/inline-in-constructors.check b/test/files/instrumented/inline-in-constructors.check
index c6c9ae4e15..b58c1d77d5 100644
--- a/test/files/instrumented/inline-in-constructors.check
+++ b/test/files/instrumented/inline-in-constructors.check
@@ -1,3 +1,7 @@
+#partest !avian
Method call statistics:
1 instrumented/Bar.<init>(Z)V
1 instrumented/Foo.<init>(I)V
+#partest avian
+!!!TEST SKIPPED!!!
+Instrumentation is not supported on Avian.
diff --git a/test/files/instrumented/inline-in-constructors/test_3.scala b/test/files/instrumented/inline-in-constructors/test_3.scala
index c4d4cc5f37..949e9945e7 100644
--- a/test/files/instrumented/inline-in-constructors/test_3.scala
+++ b/test/files/instrumented/inline-in-constructors/test_3.scala
@@ -3,13 +3,18 @@ import instrumented._
object Test {
def main(args: Array[String]) {
- // force predef initialization before profiling
- Predef
- MyPredef
- startProfiling()
- val a = new Foo(2)
- val b = new Bar(true)
- stopProfiling()
- printStatistics()
+ if (scala.tools.partest.utils.Properties.isAvian) {
+ println("!!!TEST SKIPPED!!!")
+ println("Instrumentation is not supported on Avian.")
+ } else {
+ // force predef initialization before profiling
+ Predef
+ MyPredef
+ startProfiling()
+ val a = new Foo(2)
+ val b = new Bar(true)
+ stopProfiling()
+ printStatistics()
+ }
}
}
diff --git a/test/files/neg/t6446-missing.check b/test/files/neg/t6446-missing.check
index cd867289c3..029c8057c3 100755
--- a/test/files/neg/t6446-missing.check
+++ b/test/files/neg/t6446-missing.check
@@ -1,4 +1,4 @@
-Warning: class not found: t6446.Ploogin
+Error: unable to load class: t6446.Ploogin
phase name id description
---------- -- -----------
parser 1 parse source into ASTs, perform simple desugaring
diff --git a/test/files/neg/t712.check b/test/files/neg/t712.check
index 6819dc0ce9..831e943063 100644
--- a/test/files/neg/t712.check
+++ b/test/files/neg/t712.check
@@ -1,4 +1,5 @@
t712.scala:10: error: value self is not a member of B.this.ParentImpl
+ Note: implicit method coerce is not applicable here because it comes after the application point and it lacks an explicit result type
implicit def coerce(p : ParentImpl) = p.self;
^
one error found
diff --git a/test/files/pos/t6780.scala b/test/files/pos/t6780.scala
new file mode 100644
index 0000000000..4a358046c6
--- /dev/null
+++ b/test/files/pos/t6780.scala
@@ -0,0 +1,20 @@
+object O {
+ implicit def i: Int = 0
+}
+
+import O._
+
+trait Foo {
+ implicit val v1: Any
+ implicit def d1: Any
+ val v2: Any
+ implicit val v3: Any
+}
+
+trait Bar1 extends Foo {
+ implicit val v1 = {implicitly[Int]; ()} // failed due to cycle in Context#implicits being broken with Nil.
+ def d1 = {implicitly[Int]; ()} // okay
+ implicit val v2 = {implicitly[Int]; ()} // okay
+ implicit val v3: Any = {implicitly[Int]; ()} // okay
+
+}
diff --git a/test/files/pos/t8060.scala b/test/files/pos/t8060.scala
new file mode 100644
index 0000000000..90e014d74b
--- /dev/null
+++ b/test/files/pos/t8060.scala
@@ -0,0 +1,11 @@
+trait M[F[_]]
+
+trait P[A] {
+ type CC[X] = P[X]
+ def f(p: A => Boolean): M[CC]
+}
+
+trait Other {
+ // was infinite loop trying to dealias `x$1.CC`
+ def g[A](p: A => Boolean): P[A] => M[P] = _ f p
+}
diff --git a/test/files/presentation/scope-completion-2.check b/test/files/presentation/scope-completion-2.check
index 3a1dbd7cff..d94f7a4b56 100644
--- a/test/files/presentation/scope-completion-2.check
+++ b/test/files/presentation/scope-completion-2.check
@@ -1,12 +1,11 @@
reload: Completions.scala
-askScopeCompletion at Completions.scala(16,4)
+askScopeCompletion at Completions.scala(15,2)
================================================================================
-[response] askScopeCompletion at (16,4)
-retrieved 11 members
+[response] askScopeCompletion at (15,2)
+retrieved 10 members
class Completion1 extends AnyRef
def <init>(): test.Completion1
-def test: Unit
object Completion1
private class Cc1 extends AnyRef
private class Co1 extends AnyRef
@@ -17,19 +16,18 @@ private[this] val vc1: Int
private[this] val vo1: Int
================================================================================
-askScopeCompletion at Completions.scala(32,4)
+askScopeCompletion at Completions.scala(29,2)
================================================================================
-[response] askScopeCompletion at (32,4)
-retrieved 11 members
-[inaccessible] private[this] val vc1: Int
+[response] askScopeCompletion at (29,2)
+retrieved 10 members
class Completion1 extends AnyRef
def <init>(): test.Completion1.type
-def test: Unit
object Completion1
private class Cc1 extends AnyRef
private class Co1 extends AnyRef
private def fc1: Int
private def fo1: Int
private[this] val c: test.Completion1
+private[this] val vc1: Int
private[this] val vo1: Int
================================================================================
diff --git a/test/files/presentation/scope-completion-2/src/Completions.scala b/test/files/presentation/scope-completion-2/src/Completions.scala
index 96d38f1b85..f8d7cd6ba8 100644
--- a/test/files/presentation/scope-completion-2/src/Completions.scala
+++ b/test/files/presentation/scope-completion-2/src/Completions.scala
@@ -9,12 +9,10 @@ class Completion1 {
private val vc1 = 0
private def fc1 = 0
- private class Cc1
-
- def test {
- // needs to be done in a method, because of SI-7280
- /*_*/
+ private class Cc1 {
}
+
+ /*_*/
}
object Completion1 {
@@ -25,11 +23,9 @@ object Completion1 {
private val vo1 = 0
private def fo1 = 0
- private class Co1
-
- def test {
- // needs to be done in a method, because of SI-7280
- /*_*/
+ private class Co1 {
}
+
+ /*_*/
}
diff --git a/test/files/presentation/scope-completion-3.check b/test/files/presentation/scope-completion-3.check
index cf73e89a3b..df3007ab4e 100644
--- a/test/files/presentation/scope-completion-3.check
+++ b/test/files/presentation/scope-completion-3.check
@@ -12,13 +12,9 @@ retrieved 49 members
[inaccessible] private object Ot2
[inaccessible] private type tb2 = Completion1.this.tb2
[inaccessible] private type tt2 = Completion1.this.tt2
-[inaccessible] private[this] val vb1: Int
[inaccessible] private[this] val vb2: Int
-[inaccessible] private[this] val vt1: Int
[inaccessible] private[this] val vt2: Int
-[inaccessible] private[this] var rb1: Int
[inaccessible] private[this] var rb2: Int
-[inaccessible] private[this] var rt1: Int
[inaccessible] private[this] var rt2: Int
abstract class Base1 extends AnyRef
abstract trait Trait1 extends AnyRef
@@ -42,13 +38,17 @@ private class Cc2 extends AnyRef
private def fc2: Int
private object Oc2
private type tc2 = Completion1.this.tc2
+private[this] val vb1: Int
private[this] val vb3: Int
private[this] val vc1: Int
private[this] val vc2: Int
+private[this] val vt1: Int
private[this] val vt3: Int
+private[this] var rb1: Int
private[this] var rb3: Int
private[this] var rc1: Int
private[this] var rc2: Int
+private[this] var rt1: Int
private[this] var rt3: Int
type tb1 = Completion1.this.tb1
type tc1 = Completion1.this.tc1
@@ -67,13 +67,9 @@ retrieved 49 members
[inaccessible] private object Ot2
[inaccessible] private type tb2 = test.Completion2.tb2
[inaccessible] private type tt2 = test.Completion2.tt2
-[inaccessible] private[this] val vb1: Int
[inaccessible] private[this] val vb2: Int
-[inaccessible] private[this] val vt1: Int
[inaccessible] private[this] val vt2: Int
-[inaccessible] private[this] var rb1: Int
[inaccessible] private[this] var rb2: Int
-[inaccessible] private[this] var rt1: Int
[inaccessible] private[this] var rt2: Int
abstract class Base1 extends AnyRef
abstract trait Trait1 extends AnyRef
@@ -97,13 +93,17 @@ private class Co2 extends AnyRef
private def fo2: Int
private object Oo2
private type to2 = test.Completion2.to2
+private[this] val vb1: Int
private[this] val vb3: Int
private[this] val vo1: Int
private[this] val vo2: Int
+private[this] val vt1: Int
private[this] val vt3: Int
+private[this] var rb1: Int
private[this] var rb3: Int
private[this] var ro1: Int
private[this] var ro2: Int
+private[this] var rt1: Int
private[this] var rt3: Int
type tb1 = test.Completion2.tb1
type to1 = test.Completion2.to1
diff --git a/test/files/presentation/scope-completion-import.check b/test/files/presentation/scope-completion-import.check
index d518b0c37a..220ffc399b 100644
--- a/test/files/presentation/scope-completion-import.check
+++ b/test/files/presentation/scope-completion-import.check
@@ -1,9 +1,13 @@
reload: Completions.scala
-askScopeCompletion at Completions.scala(15,4)
-================================================================================
-[response] askScopeCompletion at (15,4)
-retrieved 10 members
+askScopeCompletion at Completions.scala(23,4)
+================================================================================
+[response] askScopeCompletion at (23,4)
+retrieved 18 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] val pVOOO: Int
+[inaccessible] private[this] var pRCCC: Int
+[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -13,13 +17,21 @@ def <init>(): test.Foo
def fCCC: Int
def fOOO: Int
object O
+private[this] val vCCC: Int
+private[this] val vOOO: Int
+private[this] var rCCC: Int
+private[this] var rOOO: Int
val o: test.O.type
================================================================================
-askScopeCompletion at Completions.scala(19,4)
-================================================================================
-[response] askScopeCompletion at (19,4)
-retrieved 9 members
+askScopeCompletion at Completions.scala(27,4)
+================================================================================
+[response] askScopeCompletion at (27,4)
+retrieved 17 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] val pVOOO: Int
+[inaccessible] private[this] var pRCCC: Int
+[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -29,12 +41,18 @@ def <init>(): test.Foo
def fCCC: Int
def fOOO: Int
object O
+private[this] val vCCC: Int
+private[this] val vOOO: Int
+private[this] var rCCC: Int
+private[this] var rOOO: Int
================================================================================
-askScopeCompletion at Completions.scala(24,4)
+askScopeCompletion at Completions.scala(32,4)
================================================================================
-[response] askScopeCompletion at (24,4)
-retrieved 9 members
+[response] askScopeCompletion at (32,4)
+retrieved 13 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] var pRCCC: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -43,12 +61,14 @@ class Foo_3 extends AnyRef
def <init>(): test.Foo
def fCCC: Int
object O
+private[this] val vCCC: Int
+private[this] var rCCC: Int
val c: test.C
================================================================================
-askScopeCompletion at Completions.scala(27,5)
+askScopeCompletion at Completions.scala(35,5)
================================================================================
-[response] askScopeCompletion at (27,5)
+[response] askScopeCompletion at (35,5)
retrieved 8 members
class C extends AnyRef
class Foo extends AnyRef
@@ -60,10 +80,12 @@ object O
val c: test.C
================================================================================
-askScopeCompletion at Completions.scala(30,5)
+askScopeCompletion at Completions.scala(38,5)
================================================================================
-[response] askScopeCompletion at (30,5)
-retrieved 9 members
+[response] askScopeCompletion at (38,5)
+retrieved 13 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] var pRCCC: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -72,13 +94,19 @@ class Foo_3 extends AnyRef
def <init>(): test.Foo
def fCCC: Int
object O
+private[this] val vCCC: Int
+private[this] var rCCC: Int
val c: test.C
================================================================================
-askScopeCompletion at Completions.scala(32,5)
-================================================================================
-[response] askScopeCompletion at (32,5)
-retrieved 10 members
+askScopeCompletion at Completions.scala(40,5)
+================================================================================
+[response] askScopeCompletion at (40,5)
+retrieved 18 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] val pVOOO: Int
+[inaccessible] private[this] var pRCCC: Int
+[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -88,13 +116,21 @@ def <init>(): test.Foo
def fCCC: Int
def fOOO: Int
object O
+private[this] val vCCC: Int
+private[this] val vOOO: Int
+private[this] var rCCC: Int
+private[this] var rOOO: Int
val c: test.C
================================================================================
-askScopeCompletion at Completions.scala(41,4)
-================================================================================
-[response] askScopeCompletion at (41,4)
-retrieved 10 members
+askScopeCompletion at Completions.scala(49,4)
+================================================================================
+[response] askScopeCompletion at (49,4)
+retrieved 18 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] val pVOOO: Int
+[inaccessible] private[this] var pRCCC: Int
+[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -105,12 +141,20 @@ def bar: Unit
def fCCC: Int
def fOOO: Int
object O
+private[this] val vCCC: Int
+private[this] val vOOO: Int
+private[this] var rCCC: Int
+private[this] var rOOO: Int
================================================================================
-askScopeCompletion at Completions.scala(51,4)
-================================================================================
-[response] askScopeCompletion at (51,4)
-retrieved 11 members
+askScopeCompletion at Completions.scala(59,4)
+================================================================================
+[response] askScopeCompletion at (59,4)
+retrieved 19 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] val pVOOO: Int
+[inaccessible] private[this] var pRCCC: Int
+[inaccessible] private[this] var pROOO: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -122,12 +166,18 @@ def fCCC: Int
def fOOO: Int
object O
private[this] val o: test.O.type
+private[this] val vCCC: Int
+private[this] val vOOO: Int
+private[this] var rCCC: Int
+private[this] var rOOO: Int
================================================================================
-askScopeCompletion at Completions.scala(61,4)
+askScopeCompletion at Completions.scala(69,4)
================================================================================
-[response] askScopeCompletion at (61,4)
-retrieved 10 members
+[response] askScopeCompletion at (69,4)
+retrieved 14 members
+[inaccessible] private[this] val pVCCC: Int
+[inaccessible] private[this] var pRCCC: Int
class C extends AnyRef
class Foo extends AnyRef
class Foo_1 extends AnyRef
@@ -138,4 +188,6 @@ def bar: Unit
def fCCC: Int
object O
private[this] val c: test.C
+private[this] val vCCC: Int
+private[this] var rCCC: Int
================================================================================
diff --git a/test/files/presentation/scope-completion-import/src/Completions.scala b/test/files/presentation/scope-completion-import/src/Completions.scala
index 6e08321283..d30aa0b4e3 100644
--- a/test/files/presentation/scope-completion-import/src/Completions.scala
+++ b/test/files/presentation/scope-completion-import/src/Completions.scala
@@ -1,10 +1,18 @@
package test
class C {
+ val vCCC : Int = 0
+ var rCCC : Int = 0
+ private val pVCCC : Int = 0
+ private var pRCCC : Int = 0
def fCCC : Int = 0
}
object O extends C {
+ val vOOO : Int = 0
+ var rOOO : Int = 0
+ private val pVOOO : Int = 0
+ private var pROOO : Int = 0
def fOOO : Int = 0
}
diff --git a/test/files/run/t4841-isolate-plugins.check b/test/files/run/t4841-isolate-plugins.check
new file mode 100644
index 0000000000..a6462b424b
--- /dev/null
+++ b/test/files/run/t4841-isolate-plugins.check
@@ -0,0 +1,2 @@
+My phase name is ploogin1_1
+My phase name is ploogin1_2
diff --git a/test/files/run/t4841-isolate-plugins/ploogin.scala b/test/files/run/t4841-isolate-plugins/ploogin.scala
new file mode 100644
index 0000000000..bd8c7275ec
--- /dev/null
+++ b/test/files/run/t4841-isolate-plugins/ploogin.scala
@@ -0,0 +1,30 @@
+
+package t4841
+
+import scala.tools.nsc.{ Global, Phase }
+import scala.tools.nsc.plugins.{ Plugin, PluginComponent }
+import scala.reflect.io.Path
+import scala.reflect.io.File
+
+/** A test plugin. */
+class Ploogin(val global: Global, val name: String = "ploogin") extends Plugin {
+ import global._
+
+ val description = "A sample plugin for testing."
+ val components = List[PluginComponent](TestComponent)
+
+ private object TestComponent extends PluginComponent {
+ val global: Ploogin.this.global.type = Ploogin.this.global
+ //override val runsBefore = List("refchecks")
+ val runsAfter = List("jvm")
+ val phaseName = Ploogin.this.name
+ override def description = "A sample phase that does so many things it's kind of hard to describe briefly."
+ def newPhase(prev: Phase) = new TestPhase(prev)
+ class TestPhase(prev: Phase) extends StdPhase(prev) {
+ override def description = TestComponent.this.description
+ def apply(unit: CompilationUnit) {
+ if (settings.developer) inform(s"My phase name is $phaseName")
+ }
+ }
+ }
+}
diff --git a/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala b/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala
new file mode 100644
index 0000000000..5421922c9c
--- /dev/null
+++ b/test/files/run/t4841-isolate-plugins/t4841-isolate-plugin.scala
@@ -0,0 +1,39 @@
+
+import tools.nsc.plugins.PluginDescription
+import tools.partest.DirectTest
+
+import java.io.File
+
+// show that plugins are on isolated class loaders
+object Test extends DirectTest {
+ override def code = "class Code"
+
+ override def extraSettings = s"-usejavacp"
+
+ // plugin named ploogin1_1 or ploogin1_2, but not ploogin2_x
+ // Although the samples are in different classloaders, the plugin
+ // loader checks for distinctness by class name, so the names must differ.
+ def pluginCode(index: Int) = s"""
+ |package t4841 {
+ | class SamplePloogin$index(global: scala.tools.nsc.Global) extends Ploogin(global, s"$${PlooginCounter.named}_$index")
+ | object PlooginCounter {
+ | val count = new java.util.concurrent.atomic.AtomicInteger
+ | def named = s"ploogin$${count.incrementAndGet}"
+ | }
+ |}""".stripMargin.trim
+
+ def compilePlugin(i: Int) = {
+ val out = (testOutput / s"p$i").createDirectory()
+ val args = Seq("-usejavacp", "-d", out.path)
+ compileString(newCompiler(args: _*))(pluginCode(i))
+ val xml = PluginDescription(s"p$i", s"t4841.SamplePloogin$i").toXML
+ (out / "scalac-plugin.xml").toFile writeAll xml
+ out
+ }
+
+ override def show() = {
+ val dirs = 1 to 2 map (compilePlugin(_))
+ compile("-Xdev", s"-Xplugin:${dirs mkString ","}", "-usejavacp", "-d", testOutput.path)
+ }
+}
+
diff --git a/test/files/run/t4841-no-plugin.check b/test/files/run/t4841-no-plugin.check
new file mode 100644
index 0000000000..4338f0ce23
--- /dev/null
+++ b/test/files/run/t4841-no-plugin.check
@@ -0,0 +1 @@
+warning: No plugin in path t4841-no-plugin-run.obj/plugins.partest
diff --git a/test/files/run/t4841-no-plugin.scala b/test/files/run/t4841-no-plugin.scala
new file mode 100644
index 0000000000..d91bf7ee21
--- /dev/null
+++ b/test/files/run/t4841-no-plugin.scala
@@ -0,0 +1,17 @@
+
+import tools.partest.DirectTest
+
+import java.io.File
+
+// warn only if no plugin on Xplugin path
+object Test extends DirectTest {
+ override def code = "class Code"
+
+ override def extraSettings = s"-usejavacp -d ${testOutput.path}"
+
+ override def show() = {
+ val tmp = new File(testOutput.jfile, "plugins.partest").getAbsolutePath
+ compile("-Xdev", s"-Xplugin:$tmp", "-Xpluginsdir", tmp)
+ }
+}
+
diff --git a/test/files/run/t7912.scala b/test/files/run/t7912.scala
new file mode 100644
index 0000000000..3d603e0e97
--- /dev/null
+++ b/test/files/run/t7912.scala
@@ -0,0 +1,16 @@
+case object A { override def toString = ??? }
+
+object Test {
+ def foo: Int = (A: Any) match {
+ case 0 => 0
+ }
+ def main(args: Array[String]): Unit = {
+ try {
+ foo
+ sys.error("no exception")
+ } catch {
+ case me: MatchError => assert(me.getMessage == "an instance of class A$", me.getMessage)
+ case ex: Throwable => sys.error("not a match error: " + ex.getClass)
+ }
+ }
+}
diff --git a/test/files/run/t8010.scala b/test/files/run/t8010.scala
new file mode 100644
index 0000000000..8636bbd12e
--- /dev/null
+++ b/test/files/run/t8010.scala
@@ -0,0 +1,22 @@
+trait Base {
+ def t = 1
+ def t(n: Int) = n
+ def bt = 2
+ def bt(n: Int) = n
+}
+trait Derived extends Base {
+ // was: double defintion error
+ override def t = 1 + super.t
+ override def t(n: Int) = 1 + super.t(n)
+ override def bt = 1 + super.bt
+ override def bt(n: Int) = 1 + super.bt(n)
+}
+
+object Test extends App {
+ val d = new Derived {}
+ // not the focus of thie bug, but let's just check the runtime behaviour while we're here.
+ assert(d.t == 2)
+ assert(d.t(1) == 2)
+ assert(d.bt == 3)
+ assert(d.bt(1) == 2)
+}
diff --git a/test/files/run/t8029.scala b/test/files/run/t8029.scala
new file mode 100644
index 0000000000..dbd5c41387
--- /dev/null
+++ b/test/files/run/t8029.scala
@@ -0,0 +1,57 @@
+import scala.tools.partest._
+import scala.tools.nsc._
+
+object Test extends DirectTest {
+
+ override def extraSettings: String = "-usejavacp -nowarn -Ystop-after:typer"
+
+ override def code = "" // not used
+
+ def code1 = """
+package object p1 {
+ trait A
+ object A
+}
+ """
+
+ def code2 = """
+package object p2 {
+ class A
+ object A
+}
+ """
+
+ def code3 = """
+package object p3 {
+ object A
+ trait A
+}
+ """
+
+ def code4 = """
+package object p4 {
+ object A
+ trait A
+}
+ """
+
+ def show() {
+ val global = newCompiler()
+ import global._
+ def typecheck(code: String): Unit = {
+ val r = new Run
+ val sourceFile = newSources(code).head
+ global.reporter.reset()
+ r.compileSources(sourceFile :: Nil)
+ assert(!global.reporter.hasErrors)
+ }
+
+ def typecheckTwice(code: String): Unit = {
+ typecheck(code)
+ typecheck(code)
+ }
+
+ // was: illegal cyclic reference involving package ...
+ Seq(code1, code2, code3, code4) foreach typecheckTwice
+ }
+}
diff --git a/test/junit/scala/reflect/internal/util/StringOpsTest.scala b/test/junit/scala/reflect/internal/util/StringOpsTest.scala
new file mode 100644
index 0000000000..13d3a6435e
--- /dev/null
+++ b/test/junit/scala/reflect/internal/util/StringOpsTest.scala
@@ -0,0 +1,52 @@
+package scala.reflect.internal.util
+
+import org.junit.Assert._
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(classOf[JUnit4])
+class StringOpsTest {
+ @Test
+ def prefixOfNone(): Unit = {
+ val so = new StringOps { }
+ val ss = Nil
+ val lcp = so longestCommonPrefix ss
+ assert(lcp == "")
+ }
+ @Test
+ def prefixWithEmpty(): Unit = {
+ val so = new StringOps { }
+ val ss = List("abc", "", "abd")
+ val lcp = so longestCommonPrefix ss
+ assert(lcp == "")
+ }
+ @Test
+ def prefixOfOne(): Unit = {
+ val so = new StringOps { }
+ val ss = List("abc")
+ val lcp = so longestCommonPrefix ss
+ assert(lcp == "abc")
+ }
+ @Test
+ def prefixOfMany(): Unit = {
+ val so = new StringOps { }
+ val ss = List("abc", "abd", "abe")
+ val lcp = so longestCommonPrefix ss
+ assert(lcp == "ab")
+ }
+ @Test
+ def prefixOfPrefix(): Unit = {
+ val so = new StringOps { }
+ val ss = List("abc", "abcd")
+ val lcp = so longestCommonPrefix ss
+ assert(lcp == "abc")
+ }
+ @Test
+ def prefixOfPrefixMiddling(): Unit = {
+ val so = new StringOps { }
+ val ss = List("abce", "abc", "abcd")
+ val lcp = so longestCommonPrefix ss
+ assert(lcp == "abc")
+ }
+}