aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-10-24 22:09:59 +0200
committerMartin Odersky <odersky@gmail.com>2015-10-25 15:10:10 +0100
commit6d8f3730ca4d381b105737edaff6f8794b54e848 (patch)
tree09d5b77a27ca6af4fd9bbd6c05d6ceb3af9a6165 /tests
parentae0e1263c22e6b94b112a2b4b00a49853f0e3d58 (diff)
downloaddotty-6d8f3730ca4d381b105737edaff6f8794b54e848.tar.gz
dotty-6d8f3730ca4d381b105737edaff6f8794b54e848.tar.bz2
dotty-6d8f3730ca4d381b105737edaff6f8794b54e848.zip
Fix issue that prevented instantiating some tvars before implicit search
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/tparam_inf.scala30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/pos/tparam_inf.scala b/tests/pos/tparam_inf.scala
index 7b0ee0b36..16d99b75d 100644
--- a/tests/pos/tparam_inf.scala
+++ b/tests/pos/tparam_inf.scala
@@ -1,12 +1,38 @@
+class HasFoo[T] {
+ val x: Foo[T] = ???
+}
+class Foo[T] {
+ def get(x: T): T = x
+ def get2(x: T): Nothing = ???
+
+ def foo1(x: T)(implicit ev: T): Nothing = ???
+ def foo2(x: T)(implicit ev: T): T = ???
+ def foo3[Dummy](x: T)(implicit ev: T): Nothing = ???
+ def foo4[Dummy](x: T)(implicit ev: T): T = ???
+}
+
object Test {
+
def foo1[T](x: T)(implicit ev: T): Nothing = ???
def foo2[T](x: T)(implicit ev: T): T = ???
- def test: Unit = {
+ def test1: Unit = {
implicit val ii: Int = 42
foo1(10)
foo2(10)
}
-}
+ def hf[T]: HasFoo[T] = ???
+ def test2: Unit = {
+ implicit val ii: Int = 42
+
+ hf.x.get(10)
+ hf.x.get2(10)
+
+ hf.x.foo1(10)
+ hf.x.foo2(10)
+ hf.x.foo3(10)
+ hf.x.foo4(10)
+ }
+}