diff options
Diffstat (limited to 'tests/pos')
-rw-r--r-- | tests/pos/Patterns.scala | 2 | ||||
-rw-r--r-- | tests/pos/bounds.scala | 11 | ||||
-rw-r--r-- | tests/pos/caseClassInMethod.scala | 5 | ||||
-rw-r--r-- | tests/pos/class-dependent-extension-method.scala | 3 | ||||
-rw-r--r-- | tests/pos/compound.scala | 14 | ||||
-rw-r--r-- | tests/pos/refinedSubtyping.scala | 10 | ||||
-rw-r--r-- | tests/pos/subtyping.scala | 13 | ||||
-rw-r--r-- | tests/pos/t0674.scala | 10 | ||||
-rw-r--r-- | tests/pos/t1208.scala | 7 |
9 files changed, 69 insertions, 6 deletions
diff --git a/tests/pos/Patterns.scala b/tests/pos/Patterns.scala index 54c4d8ab2..e443c2ab5 100644 --- a/tests/pos/Patterns.scala +++ b/tests/pos/Patterns.scala @@ -6,7 +6,7 @@ object Patterns { private def rebase(tp: NamedType): Type = { def rebaseFrom(prefix: Type): Type = ??? tp.prefix match { - case RefinedThis(rt) => rebaseFrom(rt) + case SkolemType(rt) => rebaseFrom(rt) case pre: ThisType => rebaseFrom(pre) case _ => tp } diff --git a/tests/pos/bounds.scala b/tests/pos/bounds.scala new file mode 100644 index 000000000..26bc84a1b --- /dev/null +++ b/tests/pos/bounds.scala @@ -0,0 +1,11 @@ +trait Map[A, +C] { + def ++ [B1 >: C] (kvs: Iterable[Tuple2[A, B1]]): Map[A, B1] = this + def ++ [B1 >: C] (kvs: Iterator[Tuple2[A, B1]]): Map[A, B1] = this +} + +class ListMap[A, +B] extends Map[A, B] {} + +object ListMap { + def empty[X, Y] = new ListMap[X, Y] + def apply[A1, B2](elems: Tuple2[A1, B2]*): Map[A1, B2] = empty[A1,B2].++(elems.iterator) +} diff --git a/tests/pos/caseClassInMethod.scala b/tests/pos/caseClassInMethod.scala new file mode 100644 index 000000000..2e6484792 --- /dev/null +++ b/tests/pos/caseClassInMethod.scala @@ -0,0 +1,5 @@ +object t { + def f = { object C; case class C(); 1 } + def g = { case class D(x: Int); object D; 2 } + def h = { case class E(y: Int = 10); 3 } +} diff --git a/tests/pos/class-dependent-extension-method.scala b/tests/pos/class-dependent-extension-method.scala new file mode 100644 index 000000000..b557dfa8f --- /dev/null +++ b/tests/pos/class-dependent-extension-method.scala @@ -0,0 +1,3 @@ +class C(val a: String) extends AnyVal { + def foo[U <: a.type]: Unit = foo[U] +} diff --git a/tests/pos/compound.scala b/tests/pos/compound.scala new file mode 100644 index 000000000..24a936f13 --- /dev/null +++ b/tests/pos/compound.scala @@ -0,0 +1,14 @@ +abstract class A { type T } + +abstract class B { val xz: Any } + +abstract class Test { + var yy: A with B { type T; val xz: T } = null; + var xx: A with B { type T; val xz: T } = null; + xx = yy; +} + +abstract class Test2 { + var yy: A with B { type T; val xz: T } = null; + val xx: A with B { type T; val xz: T } = yy +} diff --git a/tests/pos/refinedSubtyping.scala b/tests/pos/refinedSubtyping.scala index a01be181d..e6a972e1c 100644 --- a/tests/pos/refinedSubtyping.scala +++ b/tests/pos/refinedSubtyping.scala @@ -60,3 +60,13 @@ class Test3 { y = x } +class Test4 { + + abstract class A { type T; val xz: Any } + + val yy: A { val xz: T } = null; +// val xx: A { val xz: T } = null; + val zz: A { val xz: T } = yy; + +} + diff --git a/tests/pos/subtyping.scala b/tests/pos/subtyping.scala index 95e813bdd..29d830dd2 100644 --- a/tests/pos/subtyping.scala +++ b/tests/pos/subtyping.scala @@ -16,4 +16,17 @@ object test { } +object test2 { + + class A + class B + + val x: A | B = ??? + val y: B | A = x + + val a: A & B = ??? + val b: B & A = a + +} + diff --git a/tests/pos/t0674.scala b/tests/pos/t0674.scala index 589eeec9f..a734091da 100644 --- a/tests/pos/t0674.scala +++ b/tests/pos/t0674.scala @@ -39,10 +39,10 @@ for(a <- Some(1); l <- Some(12); m <- Some(13); n <- Some(14); - o <- Some(15) -// p <- Some(16); -// q <- Some(17) -// r <- Some(18); -// s <- Some(19) + o <- Some(15); + p <- Some(16); + q <- Some(17); + r <- Some(18); + s <- Some(19) ) yield a) } diff --git a/tests/pos/t1208.scala b/tests/pos/t1208.scala new file mode 100644 index 000000000..7b14aadca --- /dev/null +++ b/tests/pos/t1208.scala @@ -0,0 +1,7 @@ +object Test { + object Foo + val f: Option[Foo.type] = Some(Foo) +} + +// unsupported with current typing rules. +// on the other hand, we need a way to refer to a module class. |