aboutsummaryrefslogblamecommitdiff
path: root/tests/pos/t5070.scala
blob: 0e5c0ffc06ffa15711a924cbd84fc58dc65a782e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                






















                                                                                        
trait A {
  type T
}

object O {
  implicit def b(implicit x: A): x.T = error("")
}

class Test {
  import O._
  implicit val a: A = new A {}
  implicitly[a.T]       // works

  implicitly[a.T](b(a)) // works
}


class ImplicitVsTypeAliasTezt {

    class Monad[m[_]] {
        type For[a] = _For[m, a]
        implicit def toFor[a](m: m[a]): For[a] = throw new Error("todo") // lookup fails
//        implicit def toFor[a](m: m[a]): _For[m, a] = throw new Error("todo") // fine.
    }

    trait _For[m[_], a] {
        def map[b](p: a => b): m[b]
    }

    def useMonad[m[_], a](m: m[a])(implicit i: Monad[m]) = {
        import i._

        // value map is not a member of type parameter m[a]
        for {
            x <- m
        } yield x.toString
    }
}