aboutsummaryrefslogtreecommitdiff
path: root/tests/untried/pos/t4692.scala
diff options
context:
space:
mode:
authorSamuel Gruetter <samuel.gruetter@epfl.ch>2014-03-12 22:44:33 +0100
committerSamuel Gruetter <samuel.gruetter@epfl.ch>2014-03-12 22:44:33 +0100
commit9ef5f6817688f814a3450126aa7383b0928e80a0 (patch)
tree5727a2f7f7fd665cefdb312af2785c692f04377c /tests/untried/pos/t4692.scala
parent194be919664447631ba55446eb4874979c908d27 (diff)
downloaddotty-9ef5f6817688f814a3450126aa7383b0928e80a0.tar.gz
dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.tar.bz2
dotty-9ef5f6817688f814a3450126aa7383b0928e80a0.zip
add tests from scala/test/files/{pos,neg}
with explicit Unit return type
Diffstat (limited to 'tests/untried/pos/t4692.scala')
-rw-r--r--tests/untried/pos/t4692.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/untried/pos/t4692.scala b/tests/untried/pos/t4692.scala
new file mode 100644
index 000000000..2ed98a6ee
--- /dev/null
+++ b/tests/untried/pos/t4692.scala
@@ -0,0 +1,27 @@
+class TypeAliasVsImplicitTest {
+
+ class For[m[_], a](x: m[a]) {
+ def map[b](y: a => b): m[b] = throw new Error
+ }
+ implicit def toFor[m[_], a](x: m[a]): For[m, a] = new For[m, a](x)
+
+ trait MyList[A]
+
+ def foo(xs: MyList[Int]) = xs.map(x => x) // compiles fine.
+
+ type MyListOfInt = MyList[Int]
+ def bar(xs: MyListOfInt) = xs.map(x => x) // doesn't compile: value map is not a member of TypeAliasVsImplicitTest.this.MyListOfInt
+}
+
+// minimal case -- the bug was in type constructor inference where `xs.type` needed to be widened *and* dealiased
+// in 2.8.1 implicit conversion search started with a widened type, so that combo never came up
+// object Test {
+// class For[m[_], a](x: m[a])
+// def toFor[m[_], a](x: m[a]): For[m, a] = new For[m, a](x)
+//
+// trait MyList[A]
+// type MyListOfInt = MyList[Int]
+//
+// val xs: MyListOfInt = error("")
+// toFor(xs : xs.type)
+// }