diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/disabled/not-representable/pos/tryexpr.scala (renamed from tests/pending/pos/tryexpr.scala) | 0 | ||||
-rw-r--r-- | tests/neg/autoTuplingTest.scala | 2 | ||||
-rw-r--r-- | tests/pending/pos/t1756.scala | 5 | ||||
-rw-r--r-- | tests/pending/pos/t2660.scala | 25 | ||||
-rw-r--r-- | tests/pos/t2913.scala (renamed from tests/pending/pos/t2913.scala) | 29 |
5 files changed, 31 insertions, 30 deletions
diff --git a/tests/pending/pos/tryexpr.scala b/tests/disabled/not-representable/pos/tryexpr.scala index c6c2febf7..c6c2febf7 100644 --- a/tests/pending/pos/tryexpr.scala +++ b/tests/disabled/not-representable/pos/tryexpr.scala diff --git a/tests/neg/autoTuplingTest.scala b/tests/neg/autoTuplingTest.scala index 37136b760..92126ab5d 100644 --- a/tests/neg/autoTuplingTest.scala +++ b/tests/neg/autoTuplingTest.scala @@ -1,4 +1,4 @@ -import dotty.language.noAutoTupling +import language.noAutoTupling object autoTuplingNeg2 { diff --git a/tests/pending/pos/t1756.scala b/tests/pending/pos/t1756.scala index 58f56ccb9..34bf273ab 100644 --- a/tests/pending/pos/t1756.scala +++ b/tests/pending/pos/t1756.scala @@ -18,6 +18,11 @@ with expected type A with Poly[A]. And no solution is found. To solve this, I added a fallback scheme similar to implicit arguments: When an implicit view that adds a method matching given arguments and result type fails, try again without the result type. + +However, troubles are not yet over. We now get an oprhan poly param C when pickling +and, if typr printer and -Ylog:front is on, an infinite type of the form + + mu x. Ring[LazyRef(x) & A] */ trait Ring[T <: Ring[T]] { def +(that: T): T diff --git a/tests/pending/pos/t2660.scala b/tests/pending/pos/t2660.scala deleted file mode 100644 index d42dcc72b..000000000 --- a/tests/pending/pos/t2660.scala +++ /dev/null @@ -1,25 +0,0 @@ -package hoho - -class G - -class H extends G - -class A[T](x: T) { - - def this(y: G, z: T) = { - this(z) - print(1) - } - - def this(z: H, h: T) = { - this(h) - print(2) - } -} - -object T { - def main(args: Array[String]): Unit = { - implicit def g2h(g: G): H = new H - new A(new H, 23) - } -} diff --git a/tests/pending/pos/t2913.scala b/tests/pos/t2913.scala index 21700e71a..f91ed7b51 100644 --- a/tests/pending/pos/t2913.scala +++ b/tests/pos/t2913.scala @@ -1,4 +1,3 @@ -import language.noAutoTupling // try with on and off class A { def foo(a: Int) = 0 @@ -10,7 +9,8 @@ class RichA { def foo() = 0 } -object Test { +object TestNoAutoTupling { + import language.noAutoTupling // try with on and off implicit def AToRichA(a: A): RichA = new RichA @@ -18,7 +18,7 @@ object Test { a.foo() a.foo(1) - a.foo("") // Without implicits, a type error regarding invalid argument types is generated at `""`. This is + 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. // @@ -29,7 +29,6 @@ object Test { 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 } // t0851 is essentially the same: @@ -53,3 +52,25 @@ object Main { () } } + +object TestWithAutoTupling { + + implicit def AToRichA(a: A): RichA = 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"`. +} + |