diff options
author | Martin Odersky <odersky@gmail.com> | 2014-05-03 13:31:27 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-05-12 12:50:38 +0200 |
commit | 1b32071acef5c7c2c08e21ee577c7cc709876ffa (patch) | |
tree | 6cf36469ca3a59b855a3c589b4542c19d3b30fb8 /tests/disabled/not-representable | |
parent | 8a4186ff782efefb98686aa35bf7f5dd1418210d (diff) | |
download | dotty-1b32071acef5c7c2c08e21ee577c7cc709876ffa.tar.gz dotty-1b32071acef5c7c2c08e21ee577c7cc709876ffa.tar.bz2 dotty-1b32071acef5c7c2c08e21ee577c7cc709876ffa.zip |
More tests
Diffstat (limited to 'tests/disabled/not-representable')
-rw-r--r-- | tests/disabled/not-representable/pos/t1357.scala | 25 | ||||
-rw-r--r-- | tests/disabled/not-representable/pos/t1381-new.scala | 37 |
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/disabled/not-representable/pos/t1357.scala b/tests/disabled/not-representable/pos/t1357.scala new file mode 100644 index 000000000..4095168d2 --- /dev/null +++ b/tests/disabled/not-representable/pos/t1357.scala @@ -0,0 +1,25 @@ +// Existential quantification cannot be expressed, and cannot be eliminated +// because it's F-bounded. Trying to paramerize BinaryTree with T instead also fails +// because the type alias cannot be represented + +object NonEmptyCons { + def unapply[H, T](c: (H, T)): Option[(H, T)] = Some(c) +} + + +object Main { + + type BT[+H, +T <: Tuple2[Tuple2[H, T], Tuple2[H, T]]] = Tuple2[H, T] + + // type T = Tuple2[String,String] + type BinaryTree[+E] = BT[E, T forSome { type T <: Tuple2[BT[E, T], BT[E, T]] }] + + def foo[E](tree: BinaryTree[E]): Unit = tree match { + case NonEmptyCons(_, tail) => { + tail match { + case NonEmptyCons(_, _) => { + } + } + } + } +} diff --git a/tests/disabled/not-representable/pos/t1381-new.scala b/tests/disabled/not-representable/pos/t1381-new.scala new file mode 100644 index 000000000..2944b1deb --- /dev/null +++ b/tests/disabled/not-representable/pos/t1381-new.scala @@ -0,0 +1,37 @@ +/* Gives + + t1381-new.scala:6: error: V is not a valid prefix for '#' + type E = V#ValueType + ^ + */ +import scala.reflect.runtime.universe._ + +class D[V <: Variable] + +class ID[V<:IV] extends D[V] { + type E = V#ValueType + def index(value:E) : Int = 0 + // Comment this out to eliminate crash. Or see below + def index(values:E*) : Iterable[Int] = null +} + +abstract class Variable { + type VT <: Variable + def d : D[VT] = null +} + +abstract class PV[T](initval:T) extends Variable { + type VT <: PV[T] + type ValueType = T +} + +trait IV extends Variable { + type ValueType +} + +abstract class EV[T](initval:T) extends PV[T](initval) with IV { + type VT <: EV[T] + override def d : ID[VT] = null + // Comment this out to eliminate crash + protected var indx = d.index(initval) +} |