diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/overloaded_extractor_and_regular_def.scala | 32 | ||||
-rw-r--r-- | test/files/pos/t1987a.scala (renamed from test/files/pos/t1987.scala) | 0 | ||||
-rw-r--r-- | test/files/pos/t2435.scala | 27 | ||||
-rw-r--r-- | test/files/pos/t2764/Ann.java | 5 | ||||
-rw-r--r-- | test/files/pos/t2764/Enum.java | 5 | ||||
-rw-r--r-- | test/files/pos/t2764/Use.scala | 6 | ||||
-rw-r--r-- | test/files/pos/t4651.scala | 12 | ||||
-rw-r--r-- | test/files/pos/t5165/TestAnnotation.java | 11 | ||||
-rw-r--r-- | test/files/pos/t5165/TestObject.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t5165/TestTrait.scala | 3 | ||||
-rw-r--r-- | test/files/pos/t5654.scala | 13 |
11 files changed, 117 insertions, 0 deletions
diff --git a/test/files/pos/overloaded_extractor_and_regular_def.scala b/test/files/pos/overloaded_extractor_and_regular_def.scala new file mode 100644 index 0000000000..c8e7da5cad --- /dev/null +++ b/test/files/pos/overloaded_extractor_and_regular_def.scala @@ -0,0 +1,32 @@ +trait TreesBase { + type Tree + + type Apply <: Tree + + val Apply: ApplyExtractor + + abstract class ApplyExtractor { + def apply(x: Int): Apply + def unapply(apply: Apply): Option[Int] + } +} + +trait TreesApi extends TreesBase { + def Apply(x: String) +} + +class Universe extends TreesApi { + abstract class Tree + case class Apply(x: Int) extends Tree + object Apply extends ApplyExtractor + def Apply(x: String) = Apply(x.toInt) +} + +object Test extends App { + def foo(tapi: TreesApi) { + import tapi._ + def bar(tree: Tree) { + val Apply(x) = tree + } + } +}
\ No newline at end of file diff --git a/test/files/pos/t1987.scala b/test/files/pos/t1987a.scala index ccab133716..ccab133716 100644 --- a/test/files/pos/t1987.scala +++ b/test/files/pos/t1987a.scala diff --git a/test/files/pos/t2435.scala b/test/files/pos/t2435.scala new file mode 100644 index 0000000000..2db931b99f --- /dev/null +++ b/test/files/pos/t2435.scala @@ -0,0 +1,27 @@ +object Bug { + abstract class FChain { + type T + + def chain(constant:String) = + new FConstant[this.type](constant, this) //removing [this.type], everything compiles + } + + case class FConstant[E <: FChain](constant:String, tail:E) extends FChain { + type T = tail.T + } + + object FNil extends FChain { + type T = Unit + } + +} + +object Test { + import Bug._ + println("Compiles:") + val a1 = FNil.chain("a").chain("a") + val a2 = a1.chain("a") + + println("\nDoesn't compile:") + val a = FNil.chain("a").chain("a").chain("a") +} diff --git a/test/files/pos/t2764/Ann.java b/test/files/pos/t2764/Ann.java new file mode 100644 index 0000000000..184fc6e864 --- /dev/null +++ b/test/files/pos/t2764/Ann.java @@ -0,0 +1,5 @@ +package bippy; + +public @interface Ann { + Enum value(); +} diff --git a/test/files/pos/t2764/Enum.java b/test/files/pos/t2764/Enum.java new file mode 100644 index 0000000000..fe07559535 --- /dev/null +++ b/test/files/pos/t2764/Enum.java @@ -0,0 +1,5 @@ +package bippy; + +public enum Enum { + VALUE; +} diff --git a/test/files/pos/t2764/Use.scala b/test/files/pos/t2764/Use.scala new file mode 100644 index 0000000000..8cf8102709 --- /dev/null +++ b/test/files/pos/t2764/Use.scala @@ -0,0 +1,6 @@ +package bippy + +class Use { + @Ann(Enum.VALUE) + def foo {} +} diff --git a/test/files/pos/t4651.scala b/test/files/pos/t4651.scala new file mode 100644 index 0000000000..0612a8fcfb --- /dev/null +++ b/test/files/pos/t4651.scala @@ -0,0 +1,12 @@ +object Test { + def analyze(x: Any) = x match { + case s: String => println("It's a string: " + s) + case 1 => println("It's a one") + case (a: Int, b) => println("It's a pair of and int " + a + + " and something " + b) + case 1 :: 2 :: _ => println("It's a list starting with 1, 2") + case List(a, b, c) => println("It's a three-element list with " + + a + ", " + b + ", " + c) + case _ => println("It's something different") + } +} diff --git a/test/files/pos/t5165/TestAnnotation.java b/test/files/pos/t5165/TestAnnotation.java new file mode 100644 index 0000000000..90886b7537 --- /dev/null +++ b/test/files/pos/t5165/TestAnnotation.java @@ -0,0 +1,11 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface TestAnnotation { + public enum TestEnumOne { A, B } + public enum TestEnumTwo { C, D } + + public TestEnumOne one(); + public TestEnumTwo two(); + public String strVal(); +} diff --git a/test/files/pos/t5165/TestObject.scala b/test/files/pos/t5165/TestObject.scala new file mode 100644 index 0000000000..eaf244e9d0 --- /dev/null +++ b/test/files/pos/t5165/TestObject.scala @@ -0,0 +1,3 @@ + +object TestObject extends TestTrait + diff --git a/test/files/pos/t5165/TestTrait.scala b/test/files/pos/t5165/TestTrait.scala new file mode 100644 index 0000000000..b317e6c6a3 --- /dev/null +++ b/test/files/pos/t5165/TestTrait.scala @@ -0,0 +1,3 @@ + +@TestAnnotation(one=TestAnnotation.TestEnumOne.A, two=TestAnnotation.TestEnumTwo.C, strVal="something") +trait TestTrait diff --git a/test/files/pos/t5654.scala b/test/files/pos/t5654.scala new file mode 100644 index 0000000000..1f8d05bfed --- /dev/null +++ b/test/files/pos/t5654.scala @@ -0,0 +1,13 @@ +class T(val a: Array[_]) + +class U { + val a = Array(Array(1, 2), Array("a","b")) +} + +class T1 { val a: Array[_] = Array(1) } + +case class Bomb(a: Array[_]) +case class Bomb2(a: Array[T] forSome { type T }) +class Okay1(a: Array[_]) +case class Okay2(s: Seq[_]) + |