aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/t8230a.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-22 11:08:22 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-22 11:08:22 +0200
commitc61892842cebdee0dbb0c7a80bb468ae20ea57e1 (patch)
treed7f4559a65fa6ebff5a3287ddf809893e0580bc5 /tests/pos/t8230a.scala
parent478be16e8d6af6004215682dda4730b78533c543 (diff)
downloaddotty-c61892842cebdee0dbb0c7a80bb468ae20ea57e1.tar.gz
dotty-c61892842cebdee0dbb0c7a80bb468ae20ea57e1.tar.bz2
dotty-c61892842cebdee0dbb0c7a80bb468ae20ea57e1.zip
Avoid junk produced by Constraint#replace.
There were two instances where a constraint undergoing a replace would still refer to poly params that are no longer bound after the replace. 1. In an ordering the replaced parameters was n ot removed from the bounds of the others. 2. When a parameter refers to the replaced parameter in a type, (not a TypeBounds), the replaced parameter was not replaced. We now have checking in place that in globally committable typer states, TypeVars are not instantiated to PolyParams and (configurable) that constraints of such typer states are always closed. Fixes #670.
Diffstat (limited to 'tests/pos/t8230a.scala')
-rw-r--r--tests/pos/t8230a.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/pos/t8230a.scala b/tests/pos/t8230a.scala
new file mode 100644
index 000000000..f878eacf8
--- /dev/null
+++ b/tests/pos/t8230a.scala
@@ -0,0 +1,26 @@
+trait Arr[T]
+object Arr {
+ def apply[T](xs: T): Arr[T] = null
+ def apply(x: Long) : Arr[Long] = null
+}
+
+object I {
+ implicit def arrToTrav[T] (a: Arr[T]) : Traversable[T] = null
+ implicit def longArrToTrav(a: Arr[Long]): Traversable[Long] = null
+}
+
+object Test {
+ def foo(t: Traversable[Any]) = {}
+
+ object Okay {
+ Arr("1")
+
+ import I.{ arrToTrav, longArrToTrav }
+ val x = foo(Arr("2"))
+ }
+
+ object Fail {
+// import I.arrToTrav
+// foo(Arr("3")) // found String, expected Long
+ }
+}