From a443bae8392b934bf379b3580fd01c88ed8014c2 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Mon, 2 Dec 2013 15:48:15 +0100 Subject: SI-8024 Pending test case for package object / overloading bug The error is new in 2.11, but actually seems correct. It appeared in 2.11.0-M4, more specifically, after https://github.com/scala/scala/pull/1554 But, the error message itself is wrong, and suggests that a method symbol has latched itself to an incorrect owner. --- test/pending/neg/t8024.check | 6 ++++++ test/pending/neg/t8024.scala | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/pending/neg/t8024.check create mode 100644 test/pending/neg/t8024.scala (limited to 'test') diff --git a/test/pending/neg/t8024.check b/test/pending/neg/t8024.check new file mode 100644 index 0000000000..b5789bf44f --- /dev/null +++ b/test/pending/neg/t8024.check @@ -0,0 +1,6 @@ +t8024.scala:13: error: reference to sqrt is ambiguous; +it is both defined in object FastComplex and imported subsequently by +import java.lang.Math.sqrt + sqrt(0d) + ^ +one error found diff --git a/test/pending/neg/t8024.scala b/test/pending/neg/t8024.scala new file mode 100644 index 0000000000..b2adeec94e --- /dev/null +++ b/test/pending/neg/t8024.scala @@ -0,0 +1,14 @@ +package p + +trait NRoot[A] + +object `package` { + final def sqrt(x: Double): Double = Math.sqrt(x) + final def sqrt[A](a: A)(implicit ev: NRoot[A]): A = ??? +} + +object FastComplex { + import java.lang.Math.sqrt + + sqrt(0d) +} -- cgit v1.2.3