summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-03-16 15:26:33 +0000
committerMartin Odersky <odersky@gmail.com>2010-03-16 15:26:33 +0000
commit2515edd33b3799ea641dba7036b35a0628d03b4b (patch)
tree61038d326d40fde0bf4e111cd08fb1a4bb999644
parente21283e8a78159fbeef2f1185a252273d2206f97 (diff)
downloadscala-2515edd33b3799ea641dba7036b35a0628d03b4b.tar.gz
scala-2515edd33b3799ea641dba7036b35a0628d03b4b.tar.bz2
scala-2515edd33b3799ea641dba7036b35a0628d03b4b.zip
Closes #2913.
different from the other errors, so no second try was done for them.)
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rwxr-xr-xtest/files/pos/t2913.scala31
2 files changed, 32 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1356fbf7f9..916ed2e75e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3306,7 +3306,7 @@ trait Typers { self: Analyzer =>
case _ => false
}
}
- if (errorInResult(fun) || (args exists errorInResult)) {
+ if (errorInResult(fun) || (args exists errorInResult) || errorInResult(tree)) {
if (printTypings) println("second try for: "+fun+" and "+args)
val Select(qual, name) = fun
val args1 = tryTypedArgs(args, argMode(fun, mode), ex)
diff --git a/test/files/pos/t2913.scala b/test/files/pos/t2913.scala
new file mode 100755
index 0000000000..4b8d89274b
--- /dev/null
+++ b/test/files/pos/t2913.scala
@@ -0,0 +1,31 @@
+class A {
+ def foo(a: Int) = 0
+}
+
+class RichA {
+ def foo(a: String) = 0
+ def foo(a: String, b: String) = 0
+ def foo() = 0
+}
+
+object Test {
+
+ implicit def AToRichA(a: A) = new RichA
+
+ val a = new A
+ a.foo()
+ a.foo(1)
+
+ a.foo("") // Without implicits, a type error regarding invalid argument types is generated at `""`. This is
+ // the same position as an argument, so the 'second try' typing with an Implicit View is tried,
+ // and AToRichA(a).foo("") is found.
+ //
+ // My reading of the spec "7.3 Views" is that `a.foo` denotes a member of `a`, so the view should
+ // not be triggered.
+ //
+ // But perhaps the implementation was changed to solve See https://lampsvn.epfl.ch/trac/scala/ticket/1756
+
+ a.foo("a", "b") // Without implicits, a type error regarding invalid arity is generated at `foo(<error>"", "")`.
+ // Typers#tryTypedApply:3274 only checks if the error is as the same position as `foo`, `"a"`, or `"b"`.
+ // None of these po
+}