diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-11 14:02:38 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 16:16:16 +0200 |
commit | a200695677237922fdf6f995c690cb0108ec2fc4 (patch) | |
tree | 5c596d3534f0ba8bf6a5c50daf5a3886eff71143 /tests/pos/t5683.scala | |
parent | 540b38cbd769cee3e8bc72530829e65f7e87cddb (diff) | |
download | dotty-a200695677237922fdf6f995c690cb0108ec2fc4.tar.gz dotty-a200695677237922fdf6f995c690cb0108ec2fc4.tar.bz2 dotty-a200695677237922fdf6f995c690cb0108ec2fc4.zip |
Fix SI-2712
Allows partially instantiated types as type constrictors when inferring higher-kinded
types.
Diffstat (limited to 'tests/pos/t5683.scala')
-rw-r--r-- | tests/pos/t5683.scala | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/pos/t5683.scala b/tests/pos/t5683.scala new file mode 100644 index 000000000..05ab03579 --- /dev/null +++ b/tests/pos/t5683.scala @@ -0,0 +1,23 @@ +object Test { + trait NT[X] + trait W[W, A] extends NT[Int] + type StringW[T] = W[String, T] + trait K[M[_], A, B] + + def k[M[_], B](f: Int => M[B]): K[M, Int, B] = null + + val okay1: K[StringW,Int,Int] = k{ (y: Int) => null: StringW[Int] } + val okay2 = k[StringW,Int]{ (y: Int) => null: W[String, Int] } + + val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] } + + // remove `extends NT[Int]`, and the last line gives an inference error + // rather than a crash. + // test/files/pos/t5683.scala:12: error: no type parameters for method k: (f: Int => M[B])Test.K[M,Int,B] exist so that it can be applied to arguments (Int => Test.W[String,Int]) + // --- because --- + // argument expression's type is not compatible with formal parameter type; + // found : Int => Test.W[String,Int] + // required: Int => ?M[?B] + // val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] } + // ^ +} |