Skip to content

Commit

Permalink
Test to close scala/bug#5075.
Browse files Browse the repository at this point in the history
  • Loading branch information
milessabin committed Mar 3, 2018
1 parent 9ba5196 commit d948e27
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/files/pos/t5075.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//Copied from Scalaz - http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/PartialApplys.scala.html
trait PartialApply1Of2[T[_, _], A] {
type Apply[B] = T[A, B]

type Flip[B] = T[B, A]
}

object Test {
trait TypeWithHigherKindParam[D[_]]
implicit def function[D[_]](t: TypeWithHigherKindParam[D]) = 1
val param: TypeWithHigherKindParam[PartialApply1Of2[Tuple2, Int]#Apply] = null

function[PartialApply1Of2[Tuple2, Int]#Apply](param): Int //Compiles
function(param) //Does not compile
param: Int //Does not compile
}

object Test2 {
//More complex variations of the same problem:
trait Exp[+T]

trait TypeWithHigherKindParam[D[_]]
def function[D[_]](t: Exp[TypeWithHigherKindParam[D]]) = null
val param: Exp[TypeWithHigherKindParam[PartialApply1Of2[Tuple2, Int]#Apply]] = null
function[PartialApply1Of2[Tuple2, Int]#Apply](param)
function(param)
}

object Test3 {
trait Exp[+T]

trait TypeWithHigherKindParam[C[X] <: Traversable[X], D[_]]

def function[C[X] <: Traversable[X], D[_]](t: Exp[TypeWithHigherKindParam[C,D]]) = null
val param: Exp[TypeWithHigherKindParam[Traversable, PartialApply1Of2[Tuple2, Int]#Apply]] = null
function[Traversable, PartialApply1Of2[Tuple2, Int]#Apply](param)
function(param)
}

0 comments on commit d948e27

Please sign in to comment.