summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-23 17:51:43 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-23 17:51:43 +0200
commitd882ec053c9a70d29e668bc80bb3f1aa830c0281 (patch)
treec3b1a54b4291c4f5f7f23b3542cd63f6be9bb780 /test/files/neg
parent65817bd2b71f5ea0e39af1b1c2b085562cd8e925 (diff)
downloadscala-d882ec053c9a70d29e668bc80bb3f1aa830c0281.tar.gz
scala-d882ec053c9a70d29e668bc80bb3f1aa830c0281.tar.bz2
scala-d882ec053c9a70d29e668bc80bb3f1aa830c0281.zip
SI-7870 Detect default getter clashes in constructors
Default getters for constructors live in the companion module. These eluded the check for clashes in default getter names due to overloading, which aims to give a more user friendly error than "double definition: meth$default$1". This commit checks for default getters in the companion module, in addition to those in the template itself.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t7870.check4
-rw-r--r--test/files/neg/t7870.scala3
2 files changed, 7 insertions, 0 deletions
diff --git a/test/files/neg/t7870.check b/test/files/neg/t7870.check
new file mode 100644
index 0000000000..d9db911ac1
--- /dev/null
+++ b/test/files/neg/t7870.check
@@ -0,0 +1,4 @@
+t7870.scala:1: error: in class C, multiple overloaded alternatives of constructor C define default arguments.
+class C(a: Int = 0, b: Any) {
+ ^
+one error found
diff --git a/test/files/neg/t7870.scala b/test/files/neg/t7870.scala
new file mode 100644
index 0000000000..5d48d43b3a
--- /dev/null
+++ b/test/files/neg/t7870.scala
@@ -0,0 +1,3 @@
+class C(a: Int = 0, b: Any) {
+ def this(a: Int = 0) = this(???, ???)
+}