summaryrefslogtreecommitdiff
path: root/test/files/pos/t2913.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/t2913.scala')
-rwxr-xr-xtest/files/pos/t2913.scala31
1 files changed, 31 insertions, 0 deletions
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
+}