aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/pos
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-05-07 14:50:56 +0200
committerSamuel Gruetter <samuel.gruetter@epfl.ch>2014-05-20 13:38:48 +0200
commitc2d5246bdb33d60d3eaff62a539d01368124d859 (patch)
tree8042d19558c350597655d5bb1dfee4ffa25e02d6 /tests/pending/pos
parent2d3c79f7cf3e79b592c7e479d262e8d3f9b04959 (diff)
downloaddotty-c2d5246bdb33d60d3eaff62a539d01368124d859.tar.gz
dotty-c2d5246bdb33d60d3eaff62a539d01368124d859.tar.bz2
dotty-c2d5246bdb33d60d3eaff62a539d01368124d859.zip
More systematic treatment of prototypes.
There's a delicate balance about how much of a prototype should be passed down the tree when typechecking. Passing little can cause ambiguity errors (both in overloading and in implicit search). Passing too much can cause spurious errors because implicit conversions "down the road" that apply to some tree continaing the result might not be considered. Symptoms of the problems wree that we could not handle the tests included in this commit before. The new scheme is as follows: we always keep all available information in a prototype, but hide nested prototypes behined a `IgnoredProto` wall. These trees will not be considered for conformity checking. When type checking hits an ambiguity, it tries again with a prototype that's one level deeper (has fewer Ignore links) than the previous one. This continues until there are no more Ignore links to unwrap. We also generalize the scheme for wrapping qualifiers of select nodes from realApply to all instances where we compare against a FunProto. Finally, there are some fixes that avoid assertion violations that were provoked by the new typechecking scheme.
Diffstat (limited to 'tests/pending/pos')
-rw-r--r--tests/pending/pos/t1693.scala9
-rw-r--r--tests/pending/pos/t1832.scala10
-rwxr-xr-xtests/pending/pos/t2060.scala44
3 files changed, 0 insertions, 63 deletions
diff --git a/tests/pending/pos/t1693.scala b/tests/pending/pos/t1693.scala
deleted file mode 100644
index 881bf89a0..000000000
--- a/tests/pending/pos/t1693.scala
+++ /dev/null
@@ -1,9 +0,0 @@
-object Test {
- class Foo
- class SomeOps(x : Foo) { def foo(x: String) = 1 }
- class OtherOps(x : Foo) { def foo(x: Int) = 1 }
- implicit def mkSomeOps(x: Foo) : SomeOps = new SomeOps(x)
- implicit def mkOtherOps(x: Foo) : OtherOps = new OtherOps(x)
-
- (new Foo).foo(1)
-}
diff --git a/tests/pending/pos/t1832.scala b/tests/pending/pos/t1832.scala
deleted file mode 100644
index 9ad9703c2..000000000
--- a/tests/pending/pos/t1832.scala
+++ /dev/null
@@ -1,10 +0,0 @@
-trait Cloning {
- trait Foo
- def fn(g: Any => Unit): Foo
-
- class Star { def *(a: Cloning.this.Foo): Cloning.this.Foo }
-
- implicit def mkStar(i: Int): Star = new Star { def *(a: Foo): Foo = null }
-
- val pool = 4 * fn { case ghostSYMBOL: Int => ghostSYMBOL * 2 }
-}
diff --git a/tests/pending/pos/t2060.scala b/tests/pending/pos/t2060.scala
deleted file mode 100755
index 0b9079062..000000000
--- a/tests/pending/pos/t2060.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/* The problem here is that we cannot insert an implicit to
- * add a polymorphic method which is then instantiated to the
- * right type. When searching for the implicit in the `fails to compile
- * line':
- *
- * val failure = 1.0 + new Op[Int]
- *
- * we reduce the problem to finding a function from Double to
- * {+: _ >: Op[Int] <: Any}, that is, a method which takes
- * an argument which is an Op[Int] or a supertype thereof.
- * Class Rich is not a subtype of this structural record, because
- * polymorphic method instantiation is not contained in subtyping.
- * That is: The method type [I](op : Op[I]): Op[I] is not a subtype
- * of (Op[Int]): Op[Int].
- * At present it is unclear whether this problem can be solved.
- */
-object Test {
- class Op[I];
- class IntOp extends Op[Int];
-
- class Rich(x : Double) {
- def + (op : IntOp): IntOp = op;
- def + [I](op : Op[I]): Op[I] = op;
- def plus [I](op : Op[I]): Op[I] = op;
- }
-
- implicit def iToRich(x : Double): Test.Rich =
- new Rich(x);
-
- // fails to compile
- val x = 1.0 + new Op[Int]
-
- // works as expected --
- // problem isn't in adding new "+"
- val a = 1.0 + new IntOp;
-
- // works as expected --
- // problem isn't in binding type variable I
- val b = 1.0 plus new Op[Int];
-
- // works as expected --
- // problem isn't in using Rich.+[I](op : Op[I])
- val c = iToRich(1.0) + new Op[Int];
-}