aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/tparam_inf.scala
blob: 16d99b75d538eddc1ec96425d7e7e1b3d3dfb6a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 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)
  }
}