From d5ef867b1f89c79f8620129693e4f1e9bc6f617c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 18 Aug 2016 17:24:11 +0200 Subject: Refinements to auto tupling There's a nasty interaction with auto-tupling and trying to insert an implicit on the qualifier of a call. If the original call fails, we need to "undo" any auto-tupling decisions in calls where an implicit is inserted on the qualifier. Also: Needed to fix canAutoTuple test so that Scala2 feature is checked instead of dotty's. Also: Drop features in dotty.language that duplicate those in scala.language. --- tests/pending/pos/t2913.scala | 55 ------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 tests/pending/pos/t2913.scala (limited to 'tests/pending') diff --git a/tests/pending/pos/t2913.scala b/tests/pending/pos/t2913.scala deleted file mode 100644 index 21700e71a..000000000 --- a/tests/pending/pos/t2913.scala +++ /dev/null @@ -1,55 +0,0 @@ -import language.noAutoTupling // try with on and off - -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): 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("", "")`. - // 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: -object test1 { - case class Foo[T,T2](f : (T,T2) => String) extends (((T,T2)) => String){ - def apply(t : T) = (s:T2) => f(t,s) - def apply(p : (T,T2)) = f(p._1,p._2) - } - implicit def g[T](f : (T,String) => String): test1.Foo[T,String] = Foo(f) - def main(args : Array[String]) : Unit = { - val f = (x:Int,s:String) => s + x - println(f(1)) - () - } -} -object Main { - def main(args : Array[String]): Unit = { - val fn = (a : Int, str : String) => "a: " + a + ", str: " + str - implicit def fx[T](f : (T,String) => String): T => String = (x:T) => f(x,null) - println(fn(1)) - () - } -} -- cgit v1.2.3 From 806a7b3b6f8c6e7df276bceaa7b0a19c580a3486 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 18 Aug 2016 17:50:43 +0200 Subject: Test reshuffling - Delete redundant t2660 (exists elready in pos) - Comment t1756 - Recategorize tryexpr --- tests/disabled/not-representable/pos/tryexpr.scala | 10 +++++++++ tests/pending/pos/t1756.scala | 5 +++++ tests/pending/pos/t2660.scala | 25 ---------------------- tests/pending/pos/tryexpr.scala | 10 --------- 4 files changed, 15 insertions(+), 35 deletions(-) create mode 100644 tests/disabled/not-representable/pos/tryexpr.scala delete mode 100644 tests/pending/pos/t2660.scala delete mode 100644 tests/pending/pos/tryexpr.scala (limited to 'tests/pending') diff --git a/tests/disabled/not-representable/pos/tryexpr.scala b/tests/disabled/not-representable/pos/tryexpr.scala new file mode 100644 index 000000000..c6c2febf7 --- /dev/null +++ b/tests/disabled/not-representable/pos/tryexpr.scala @@ -0,0 +1,10 @@ +// stretching more flexible try/catch's legs a bit +object o { + try Integer.parseInt("xxxx") catch { case e => 5 } + try 5 + try try try 10 + try try try 10 catch { case e => 20 } finally 30 + try try try 10 catch { case e => 20 } finally 30 finally 40 + try try try 10 catch { case e => 20 } finally 30 finally 40 finally 50 + try try try 10 finally 50 +} 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/tryexpr.scala b/tests/pending/pos/tryexpr.scala deleted file mode 100644 index c6c2febf7..000000000 --- a/tests/pending/pos/tryexpr.scala +++ /dev/null @@ -1,10 +0,0 @@ -// stretching more flexible try/catch's legs a bit -object o { - try Integer.parseInt("xxxx") catch { case e => 5 } - try 5 - try try try 10 - try try try 10 catch { case e => 20 } finally 30 - try try try 10 catch { case e => 20 } finally 30 finally 40 - try try try 10 catch { case e => 20 } finally 30 finally 40 finally 50 - try try try 10 finally 50 -} -- cgit v1.2.3