diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/pos/t8060.scala | 11 | ||||
-rw-r--r-- | test/files/presentation/scope-completion-2.check | 16 | ||||
-rw-r--r-- | test/files/presentation/scope-completion-2/src/Completions.scala | 16 | ||||
-rw-r--r-- | test/files/presentation/scope-completion-3.check | 16 | ||||
-rw-r--r-- | test/files/presentation/scope-completion-import.check | 114 | ||||
-rw-r--r-- | test/files/presentation/scope-completion-import/src/Completions.scala | 8 | ||||
-rw-r--r-- | test/files/run/t7912.scala | 16 | ||||
-rw-r--r-- | test/files/run/t8010.scala | 22 | ||||
-rw-r--r-- | test/files/run/t8029.scala | 57 |
9 files changed, 218 insertions, 58 deletions
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/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 + } +} |