diff options
Diffstat (limited to 'test/files/presentation')
-rw-r--r-- | test/files/presentation/ide-t1001326.check | 4 | ||||
-rw-r--r-- | test/files/presentation/ide-t1001326/src/a/A.scala | 5 | ||||
-rw-r--r-- | test/files/presentation/parse-invariants.check | 5 | ||||
-rw-r--r-- | test/files/presentation/parse-invariants/Test.scala (renamed from test/files/presentation/ide-t1001326/Test.scala) | 32 | ||||
-rw-r--r-- | test/files/presentation/parse-invariants/src/a/A.scala | 138 | ||||
-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 |
10 files changed, 279 insertions, 75 deletions
diff --git a/test/files/presentation/ide-t1001326.check b/test/files/presentation/ide-t1001326.check deleted file mode 100644 index 0ac15faed4..0000000000 --- a/test/files/presentation/ide-t1001326.check +++ /dev/null @@ -1,4 +0,0 @@ -Unique OK -Unattributed OK -NeverModify OK -AlwaysParseTree OK
\ No newline at end of file diff --git a/test/files/presentation/ide-t1001326/src/a/A.scala b/test/files/presentation/ide-t1001326/src/a/A.scala deleted file mode 100644 index c82ca02231..0000000000 --- a/test/files/presentation/ide-t1001326/src/a/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -package a - -class A { - def foo(s: String) = s + s -}
\ No newline at end of file diff --git a/test/files/presentation/parse-invariants.check b/test/files/presentation/parse-invariants.check new file mode 100644 index 0000000000..32e9c846ab --- /dev/null +++ b/test/files/presentation/parse-invariants.check @@ -0,0 +1,5 @@ +NoNewSymbolsEntered OK +Unique OK +Unattributed OK +NeverModify OK +AlwaysParseTree OK diff --git a/test/files/presentation/ide-t1001326/Test.scala b/test/files/presentation/parse-invariants/Test.scala index ff63b9770a..128896ccaa 100644 --- a/test/files/presentation/ide-t1001326/Test.scala +++ b/test/files/presentation/parse-invariants/Test.scala @@ -6,16 +6,32 @@ object Test extends InteractiveTest { override def execute(): Unit = { val sf = sourceFiles.find(_.file.name == "A.scala").head - uniqueParseTree_t1001326(sf) - unattributedParseTree_t1001326(sf) - neverModifyParseTree_t1001326(sf) - shouldAlwaysReturnParseTree_t1001326(sf) + noNewSymbols(sf) + uniqueParseTree(sf) + unattributedParseTree(sf) + neverModifyParseTree(sf) + shouldAlwaysReturnParseTree(sf) + } + + /** + * Asking for a parseTree should not enter any new symbols. + */ + private def noNewSymbols(sf: SourceFile) { + def nextId() = compiler.NoSymbol.newTermSymbol(compiler.TermName("dummy"), compiler.NoPosition, compiler.NoFlags).id + val id = nextId() + val tree = compiler.parseTree(sf) + val id2 = nextId() + if (id2 == id + 1) { + reporter.println("NoNewSymbolsEntered OK") + } else { + reporter.println("NoNewSymbolsEntered FAILED") + } } /** * Asking twice for a parseTree on the same source should always return a new tree */ - private def uniqueParseTree_t1001326(sf: SourceFile) { + private def uniqueParseTree(sf: SourceFile) { val parseTree1 = compiler.parseTree(sf) val parseTree2 = compiler.parseTree(sf) if (parseTree1 != parseTree2) { @@ -28,7 +44,7 @@ object Test extends InteractiveTest { /** * A parseTree should never contain any symbols or types */ - private def unattributedParseTree_t1001326(sf: SourceFile) { + private def unattributedParseTree(sf: SourceFile) { if (noSymbolsOrTypes(compiler.parseTree(sf))) { reporter.println("Unattributed OK") } else { @@ -39,7 +55,7 @@ object Test extends InteractiveTest { /** * Once you have obtained a parseTree it should never change */ - private def neverModifyParseTree_t1001326(sf: SourceFile) { + private def neverModifyParseTree(sf: SourceFile) { val parsedTree = compiler.parseTree(sf) loadSourceAndWaitUntilTypechecked(sf) if (noSymbolsOrTypes(parsedTree)) { @@ -52,7 +68,7 @@ object Test extends InteractiveTest { /** * Should always return a parse tree */ - private def shouldAlwaysReturnParseTree_t1001326(sf: SourceFile) { + private def shouldAlwaysReturnParseTree(sf: SourceFile) { loadSourceAndWaitUntilTypechecked(sf) if (noSymbolsOrTypes(compiler.parseTree(sf))) { reporter.println("AlwaysParseTree OK") diff --git a/test/files/presentation/parse-invariants/src/a/A.scala b/test/files/presentation/parse-invariants/src/a/A.scala new file mode 100644 index 0000000000..1ae78cad05 --- /dev/null +++ b/test/files/presentation/parse-invariants/src/a/A.scala @@ -0,0 +1,138 @@ +package syntax + +object Terms { + object Literals { + 0 + 0l + 0f + 0d + 0xb33f + 'c' + "string" + """ + multi-line + string + """ + 'symbol + true + false + null + () + } + + object Patterns { + 0 match { case 0 => } + 1 match { case (0 | 1) => } + 2 match { case _: Int => } + 3 match { case _ => } + Some(0) match { case Some(0) => } + Some(0) match { case name @ Some(_) => } + Some(Some(0)) match { case nested @ Some(deeper @ Some(_)) => } + List(1, 2, 3) match { case unapplySeq @ List(1, 2, _*) => } + 0 match { case i if i > 0 => } + List(1) match { case _: List[t] => List.empty[t] } + } + + object New { + class Foo + trait Bar + new Foo + new Foo { selfie => } + new Foo with Bar + new { val early = 1 } with Bar + new { val name = "anon "} + } + + def tuple = (1, 'two, "three") + def lambda = (x: Int, y: Int) => x + y + def lambda2 = (_: Int) + (_: Int) + def blocks = { { {}; {} }; {} } + def ascription = (1: Int) + def select = Nil.size + def method1 = "s".replace("foo", "bar") + def method2 = "s" + "s" + def method3 = Nil.foreach { e => } + def method4 = 1 :: 2 :: 3 :: Nil + def if1 = if (true) true else false + def if2 = if (true) true + def `return`: Int = { return 0 } + def `throw` = throw new Exception + def `match` = 0 match { case 0 => case _ => } + def `try` = try 0 catch { case _ => } finally 0 + def `while` = while(true) 0 + def `do while` = do 0 while(true) + def `for` = for (i <- 1 to 10; if i % 2 == 0; j = i + 1) j + def `for yield` = for (a <- List(List(1)); b <- a; c = b * 2) yield b + def interpolation = s"$tuple and maybe also $blocks" + def assign = { var x = 1; x = 2 } + def assign2 = { object o { var x = 1 }; o.x = 2 } + def update = { val v = collection.mutable.Seq(1); v(0) = 2 } + def `this` = this +} + +object Types { + type Reference = scala.App + type Tuple = (Int, String, Double) + type Function = (Int, String) => Double + type Refined = Int { val meta: Any } + type Lambda = ({ type F[T] = List[T] })#F[_] + type Infix = Int Either String + type Application = List[Int] + type Existential = List[T] forSome { type T } + object O { type T = Int } + type Dependent = O.T + class O { type T = Int } + type Selection = O#T +} + +object Definitions { + private val x1 = 0 + private[this] val x2 = 0 + private[Definitions] val x3 = 0 + protected val x4 = 0 + protected[AcessManagement] val x5 = 0 + val x1 = 1 + val x2: Int = 1 + val x3, y3 = 1 + lazy val x4 = 1 + implicit val x5 = 1 + final val x6 = 1 + lazy final val x7 = 1 + val Some(x8) = Some(0) + var x9 = 1 + var x10, y10 = 1 + var x11: Int = 1 + + implicit def implicitView: Option[Int] = None + def implicitArg1(implicit i: Int) = i + 2 + def implicitArg2[T: Fooable] = implicitly[Fooable[T]] + def bound1[T <: Int](x: T): T = x + def bound2[T >: Any](x: T): T = x + def bound3[T <% Int](x: T): Int = x + def vararg(args: Int*) = args.toList + def sum(x: Int, y: Int) = x + y + def multipleArgLists(x: Int)(y: Int) = x + y + + type _0 = Int + type _1[T] = List[T] + type _2[A, B] = Either[A, B] + + class Val(value: Int) extends AnyVal + implicit class Impl(value: Int) { def foo = "foo" } + abstract class Abs + sealed class Sealed + class Child extends Sealed + case class Point(x: Int, y: Int) + + trait Fooable[T] + trait Barable with Fooable[Barable] + + object Foo + object Foo with Fooable[Foo] + case object Zero +} + +package Packages { + package object PackageObject + package Nested { package Deeper { } } +} 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 } |