summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-08-21 07:15:27 +0200
committerPaul Phillips <paulp@improving.org>2012-09-01 10:02:22 -0700
commitd9c0cb6165bd60d79bdf764291c417c86623b042 (patch)
tree7b9db194590ae8d884d4cafc2e12f923b4d893ba
parent6b87cdcd7bd6d1932e87e6bf8dc6029d6461a488 (diff)
downloadscala-d9c0cb6165bd60d79bdf764291c417c86623b042.tar.gz
scala-d9c0cb6165bd60d79bdf764291c417c86623b042.tar.bz2
scala-d9c0cb6165bd60d79bdf764291c417c86623b042.zip
Suppressed 'possible cause' mis-warning.
I have seen this warning a bunch of times and it has not yet been close to right.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala11
-rw-r--r--test/files/buildmanager/t2650_3/t2650_3.check1
-rw-r--r--test/files/buildmanager/t2650_4/t2650_4.check1
-rw-r--r--test/files/neg/not-possible-cause.check10
-rw-r--r--test/files/neg/not-possible-cause.scala3
5 files changed, 23 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 28636fc76e..1b3602fca2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -280,7 +280,16 @@ trait Infer {
def issue(err: AbsTypeError): Unit = context.issue(err)
- def isPossiblyMissingArgs(found: Type, req: Type) = (found.resultApprox ne found) && isWeaklyCompatible(found.resultApprox, req)
+ def isPossiblyMissingArgs(found: Type, req: Type) = (
+ false
+ /** However it is that this condition is expected to imply
+ * "is possibly missing args", it is too weak. It is
+ * better to say nothing than to offer misleading guesses.
+
+ (found.resultApprox ne found)
+ && isWeaklyCompatible(found.resultApprox, req)
+ */
+ )
def explainTypes(tp1: Type, tp2: Type) =
withDisambiguation(List(), tp1, tp2)(global.explainTypes(tp1, tp2))
diff --git a/test/files/buildmanager/t2650_3/t2650_3.check b/test/files/buildmanager/t2650_3/t2650_3.check
index c109800d9c..5c6326d59f 100644
--- a/test/files/buildmanager/t2650_3/t2650_3.check
+++ b/test/files/buildmanager/t2650_3/t2650_3.check
@@ -10,6 +10,5 @@ B.scala:2: error: type mismatch;
found : a.T
(which expands to) Long
required: Int
- possible cause: missing arguments for method or constructor
def x(a: A): Int = a.x
^
diff --git a/test/files/buildmanager/t2650_4/t2650_4.check b/test/files/buildmanager/t2650_4/t2650_4.check
index 89536776bd..a4aeaddfbb 100644
--- a/test/files/buildmanager/t2650_4/t2650_4.check
+++ b/test/files/buildmanager/t2650_4/t2650_4.check
@@ -10,6 +10,5 @@ B.scala:2: error: type mismatch;
found : a.T2
(which expands to) Long
required: Int
- possible cause: missing arguments for method or constructor
def x(a: A): Int = a.x
^
diff --git a/test/files/neg/not-possible-cause.check b/test/files/neg/not-possible-cause.check
new file mode 100644
index 0000000000..9111cd0d3d
--- /dev/null
+++ b/test/files/neg/not-possible-cause.check
@@ -0,0 +1,10 @@
+not-possible-cause.scala:2: error: type mismatch;
+ found : a.type (with underlying type A)
+ required: AnyRef
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method any2stringfmt in object Predef of type (x: Any)scala.runtime.StringFormat
+ and method any2stringadd in object Predef of type (x: Any)scala.runtime.StringAdd
+ are possible conversion functions from a.type to AnyRef
+ def foo[A <: Product](a: A) { type X = a.type }
+ ^
+one error found
diff --git a/test/files/neg/not-possible-cause.scala b/test/files/neg/not-possible-cause.scala
new file mode 100644
index 0000000000..83ec24dec8
--- /dev/null
+++ b/test/files/neg/not-possible-cause.scala
@@ -0,0 +1,3 @@
+object Foo {
+ def foo[A <: Product](a: A) { type X = a.type }
+}