summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-03 14:15:30 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-03 14:15:30 -0700
commitb34313db72b7c42fb403677487bd9ac00257993e (patch)
tree520fb709066f01bb73a6fa2f2ed900c20ba118ec /test
parent09f0814d2fbad488e92c60d7df363d12f350d869 (diff)
parent80d986997e58b5195654b6f9ca8cd81bc62f4bbf (diff)
downloadscala-b34313db72b7c42fb403677487bd9ac00257993e.tar.gz
scala-b34313db72b7c42fb403677487bd9ac00257993e.tar.bz2
scala-b34313db72b7c42fb403677487bd9ac00257993e.zip
Merge pull request #661 from retronym/ticket/5683
SI-5683 Fail gracefully when transposing a ragged type arg matrix.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t5683.check16
-rw-r--r--test/files/neg/t5683.scala23
2 files changed, 39 insertions, 0 deletions
diff --git a/test/files/neg/t5683.check b/test/files/neg/t5683.check
new file mode 100644
index 0000000000..7c0e50113c
--- /dev/null
+++ b/test/files/neg/t5683.check
@@ -0,0 +1,16 @@
+t5683.scala:12: error: inferred kinds of the type arguments (Object,Int) do not conform to the expected kinds of the type parameters (type M,type B).
+Object's type parameters do not match type M's expected parameters:
+class Object has no type parameters, but type M has one
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ ^
+t5683.scala:12: error: type mismatch;
+ found : Int => Test.W[String,Int]
+ required: Int => M[B]
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ ^
+t5683.scala:12: error: type mismatch;
+ found : Test.K[M,Int,B]
+ required: Test.K[Test.StringW,Int,Int]
+ val crash: K[StringW,Int,Int] = k{ (y: Int) => null: W[String, Int] }
+ ^
+three errors found
diff --git a/test/files/neg/t5683.scala b/test/files/neg/t5683.scala
new file mode 100644
index 0000000000..05ab035792
--- /dev/null
+++ b/test/files/neg/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] }
+ // ^
+}