diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-12-02 16:13:57 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-12-12 15:06:22 +0100 |
commit | e6cee2627555f379ef6cd8cd554a1079a7e074aa (patch) | |
tree | 3f9387297af328e26663150dd68950007a84eb46 /test/files/neg | |
parent | a443bae8392b934bf379b3580fd01c88ed8014c2 (diff) | |
download | scala-e6cee2627555f379ef6cd8cd554a1079a7e074aa.tar.gz scala-e6cee2627555f379ef6cd8cd554a1079a7e074aa.tar.bz2 scala-e6cee2627555f379ef6cd8cd554a1079a7e074aa.zip |
SI-8024 Fix inaccurate message on overloaded ambiguous ident
`Symbol#owner` of an overloaded symbol doesn't necessarily correspond
to the owner of any of the alternatives, and as such it shouldn't
be used in error message.
neg/t8024.scala actually represents a progression since 2.10.3;
the ambiguity was not reported. I bisected the change to
https://github.com/scala/scala/pull/1554.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t8024.check | 6 | ||||
-rw-r--r-- | test/files/neg/t8024.scala | 14 | ||||
-rw-r--r-- | test/files/neg/t8024b.check | 6 | ||||
-rw-r--r-- | test/files/neg/t8024b.scala | 17 |
4 files changed, 43 insertions, 0 deletions
diff --git a/test/files/neg/t8024.check b/test/files/neg/t8024.check new file mode 100644 index 0000000000..f04e4add9c --- /dev/null +++ b/test/files/neg/t8024.check @@ -0,0 +1,6 @@ +t8024.scala:13: error: reference to sqrt is ambiguous; +it is both defined in package package and imported subsequently by +import java.lang.Math.sqrt + sqrt(0d) + ^ +one error found diff --git a/test/files/neg/t8024.scala b/test/files/neg/t8024.scala new file mode 100644 index 0000000000..b4c2c5ebb9 --- /dev/null +++ b/test/files/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) +} diff --git a/test/files/neg/t8024b.check b/test/files/neg/t8024b.check new file mode 100644 index 0000000000..9cd89bca53 --- /dev/null +++ b/test/files/neg/t8024b.check @@ -0,0 +1,6 @@ +t8024b.scala:15: 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/files/neg/t8024b.scala b/test/files/neg/t8024b.scala new file mode 100644 index 0000000000..cf3d496365 --- /dev/null +++ b/test/files/neg/t8024b.scala @@ -0,0 +1,17 @@ +package p + +trait NRoot[A] + +object FastComplex { + final def sqrt(x: Double): Double = Math.sqrt(x) + final def sqrt[A](a: A)(implicit ev: NRoot[A]): A = ??? + + object Inner { + import java.lang.Math.sqrt + + // wrong message: + // error: reference to sqrt is ambiguous; + // it is both defined in object FastComplex and imported subsequently by + sqrt(0d) + } +} |