summaryrefslogtreecommitdiff
path: root/test/pending/run/hk-lub-fail.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-07-13 02:08:43 +0000
committerPaul Phillips <paulp@improving.org>2011-07-13 02:08:43 +0000
commitcda484779f3de0ca59aff243326f5a414e63b946 (patch)
tree11002612d3cb8a0f7679afbf6d1545e0faf372d1 /test/pending/run/hk-lub-fail.scala
parent360f747c67006bc281ab28af3565eb602ed68b7c (diff)
downloadscala-cda484779f3de0ca59aff243326f5a414e63b946.tar.gz
scala-cda484779f3de0ca59aff243326f5a414e63b946.tar.bz2
scala-cda484779f3de0ca59aff243326f5a414e63b946.zip
A response to adriaan's last lub commit of the ...
A response to adriaan's last lub commit of the housekeeping and pretty printing variety. Non-invasive surgery, don't worry martin. Simplified the input to lublist a bit. Includes illustrative test case for current brand of lub failures. Review by moors.
Diffstat (limited to 'test/pending/run/hk-lub-fail.scala')
-rw-r--r--test/pending/run/hk-lub-fail.scala37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/pending/run/hk-lub-fail.scala b/test/pending/run/hk-lub-fail.scala
new file mode 100644
index 0000000000..26bd85c943
--- /dev/null
+++ b/test/pending/run/hk-lub-fail.scala
@@ -0,0 +1,37 @@
+// Tue Jul 12 16:38:23 PDT 2011
+
+class Bip[T1]
+class Foo[T2] extends Bip[T2]
+class Bar[T3] extends Bip[T3]
+
+abstract class Factory[CC[X] <: Bip[X]] { }
+
+object Quux1 extends Factory[Foo]
+object Quux2 extends Factory[Bar]
+
+object Test {
+ // FAIL
+ val xs = List(Quux1, Quux2)
+ // error: type mismatch;
+ // found : Quux1.type (with underlying type object Quux1)
+ // required: Factory[_ >: Bar with Foo <: Bip]
+ // ^^ ^^ ^^ ^^ <-- QUIZ: what is missing from these types?
+
+ // The type it should figure out, come on scalac
+ type F = Factory[CC] forSome { type X ; type CC[X] >: Bar[X] with Foo[X] <: Bip[X] }
+
+ // No problem
+ val ys = List[F](Quux1, Quux2)
+
+ // A repl session to get you started.
+/*
+ val quux1 = EmptyPackageClass.tpe.member(newTermName("Quux1"))
+ val quux2 = EmptyPackageClass.tpe.member(newTermName("Quux2"))
+ val tps = List(quux1, quux2) map (_.tpe)
+ val test = EmptyPackageClass.tpe.member(newTermName("Test"))
+ val f = test.tpe.member(newTypeName("F")).tpe
+
+ val fn = f.normalize.asInstanceOf[ExistentialType]
+ val fn2 = fn.underlying.asInstanceOf[TypeRef]
+*/
+}