aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-07-12 17:12:59 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-12 18:14:04 +0200
commit84a1a7ae7b1e4931fe04a5a21a04bb858e8acebb (patch)
tree0cb537aeafff402970ce51c0790cd9ba4e8de846 /tests
parentcdebd91712b36b048233d7cf9501cc7a5bb50b31 (diff)
downloaddotty-84a1a7ae7b1e4931fe04a5a21a04bb858e8acebb.tar.gz
dotty-84a1a7ae7b1e4931fe04a5a21a04bb858e8acebb.tar.bz2
dotty-84a1a7ae7b1e4931fe04a5a21a04bb858e8acebb.zip
Avoid dealiasing on type application
When applying a type alias of a type lambda, keep the original application instead of reducing. But reduce anyway if - the reduced type is an application where the type constructor has the same kind as the original type constructor, or - some of the arguments are wildcards.
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/boundspropagation.scala2
-rw-r--r--tests/neg/i94-nada.scala11
-rw-r--r--tests/pos/i94-nada.scala2
-rw-r--r--tests/pos/t2712-6.scala12
4 files changed, 14 insertions, 13 deletions
diff --git a/tests/neg/boundspropagation.scala b/tests/neg/boundspropagation.scala
index b545b09da..dd4ebf513 100644
--- a/tests/neg/boundspropagation.scala
+++ b/tests/neg/boundspropagation.scala
@@ -40,5 +40,5 @@ object test4 {
}
class Test5 {
-"": ({ type U = this.type })#U // error // error
+"": ({ type U = this.type })#U // error
}
diff --git a/tests/neg/i94-nada.scala b/tests/neg/i94-nada.scala
deleted file mode 100644
index 8ca104e06..000000000
--- a/tests/neg/i94-nada.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-trait Test1 {
- trait Monad[MX] {
- def x: MX
- }
- sealed abstract class Either[A,B]
- case class Left[A,B](x: A) extends Either[A,B] with Monad[A]
- case class Right[A,B](x: B) extends Either[A,B] with Monad[B]
- def flatMap[FX,FY,M[FMX]<:Monad[FMX]](m: M[FX], f: FX => M[FY]): M[FY] = f(m.x)
- println(flatMap(Left(1), {x: Int => Left(x)})) // error: Left does not conform to [X] -> Monad[X]
-
-}
diff --git a/tests/pos/i94-nada.scala b/tests/pos/i94-nada.scala
index 1c7d88a10..2c3cf895c 100644
--- a/tests/pos/i94-nada.scala
+++ b/tests/pos/i94-nada.scala
@@ -35,7 +35,7 @@ trait Test2 {
case class Left[A,B](x: A) extends Either[A,B] with Monad[A]
case class Right[A,B](x: B) extends Either[A,B] with Monad[B]
def flatMap[X,Y,M[X]](m: M[X], f: X => M[Y]): M[Y]
- println(flatMap(Right(1), {x: Int => Right(x)}))
+ println(flatMap(Left(1), {x: Int => Left(x)}))
}
trait Test3 {
def flatMap[X,Y,M[X]](m: M[X], f: X => M[Y]): M[Y]
diff --git a/tests/pos/t2712-6.scala b/tests/pos/t2712-6.scala
new file mode 100644
index 000000000..dbba60472
--- /dev/null
+++ b/tests/pos/t2712-6.scala
@@ -0,0 +1,12 @@
+package test
+
+object Tags {
+ type Tagged[A, T] = {type Tag = T; type Self = A}
+
+ type @@[T, Tag] = Tagged[T, Tag]
+
+ trait Disjunction
+
+ def meh[M[_], A](ma: M[A]): M[A] = ma
+ meh(null: Int @@ Disjunction)//.asInstanceOf[Int @@ Disjunction])
+}