summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2014-07-03 10:52:43 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2014-07-03 10:52:43 +0200
commit2c089140754f1d039b1b9e56032ab9fdd994f201 (patch)
treebf60d36dd0ee4c8ca8fc27e732b360818cd1de4d /test
parente67146c6e8758b070f6ce4eeb43d289980bfe51a (diff)
parent5ba129070f46da9b981d36afe2f9f0aac50c3800 (diff)
downloadscala-2c089140754f1d039b1b9e56032ab9fdd994f201.tar.gz
scala-2c089140754f1d039b1b9e56032ab9fdd994f201.tar.bz2
scala-2c089140754f1d039b1b9e56032ab9fdd994f201.zip
Merge pull request #3828 from retronym/ticket/8675
SI-8675 Avoid unreported error after second try using implicit view
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t8675.check11
-rw-r--r--test/files/neg/t8675.scala24
-rw-r--r--test/files/neg/t8675b.check6
-rw-r--r--test/files/neg/t8675b.scala22
4 files changed, 63 insertions, 0 deletions
diff --git a/test/files/neg/t8675.check b/test/files/neg/t8675.check
new file mode 100644
index 0000000000..4e44fba918
--- /dev/null
+++ b/test/files/neg/t8675.check
@@ -0,0 +1,11 @@
+t8675.scala:13: error: type mismatch;
+ found : Boolean(true)
+ required: String
+ a.update(0, x[A]({new isString(true)})) // !!! allowed
+ ^
+t8675.scala:22: error: type mismatch;
+ found : Boolean(true)
+ required: String
+ new X().m(x[A]({new isString(true)})) // !!! allowed
+ ^
+two errors found
diff --git a/test/files/neg/t8675.scala b/test/files/neg/t8675.scala
new file mode 100644
index 0000000000..ca9bb57ffa
--- /dev/null
+++ b/test/files/neg/t8675.scala
@@ -0,0 +1,24 @@
+class A(s: String) {
+ def foo(x: A) = x
+}
+
+class isString(s: String)
+
+class Test {
+
+ def x[A](a: Any): A = ???
+
+ def test {
+ val a = Array[A]()
+ a.update(0, x[A]({new isString(true)})) // !!! allowed
+
+ // boils down to
+ class X {
+ def m(p: Any) {}
+ }
+ implicit class XOps(x: X) {
+ def m(p: Any) {}
+ }
+ new X().m(x[A]({new isString(true)})) // !!! allowed
+ }
+}
diff --git a/test/files/neg/t8675b.check b/test/files/neg/t8675b.check
new file mode 100644
index 0000000000..cb7ac8af59
--- /dev/null
+++ b/test/files/neg/t8675b.check
@@ -0,0 +1,6 @@
+t8675b.scala:19: error: missing parameter type for expanded function
+The argument types of an anonymous function must be fully known. (SLS 8.5)
+Expected type was: List[Test.Reportable1[?,?]] => Boolean
+ for (path: List[Any] <- (null : Engine1).asRequirement.pathsIncludingSelf.toList) {
+ ^
+one error found
diff --git a/test/files/neg/t8675b.scala b/test/files/neg/t8675b.scala
new file mode 100644
index 0000000000..2c5015b1d0
--- /dev/null
+++ b/test/files/neg/t8675b.scala
@@ -0,0 +1,22 @@
+object Test {
+ trait Engine1
+
+ implicit class EngineTools1[Params, R](e: Engine1) {
+ def asRequirement: Requirement1[Params, R] = ???
+ }
+ trait Requirement1[Params, R] {
+ def pathsIncludingSelf: Traversable[List[Reportable1[Params, R]]]
+ }
+ trait Reportable1[Params, R]
+
+ // "missing paramater type" error was swallowed in 2.11.0 leading to a crash
+ // in the backend.
+ //
+ // This error is itself a regression (or at least a change) in 2.11.0-M7,
+ // specifically in SI-7944. The type paramaters to the implicit view
+ // `EngineTools1` are undetermined, and are now treated as type variables
+ // in the expected type of the closure argument to `withFilter`.
+ for (path: List[Any] <- (null : Engine1).asRequirement.pathsIncludingSelf.toList) {
+ ???
+ }
+}