summaryrefslogtreecommitdiff
path: root/test/files/neg/double-def-top-level.check
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-05-21 10:25:21 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-05-26 17:30:35 +0200
commita6714f8fee2f8df9bc9d4760ed4c0c799f4f2c11 (patch)
treea62309adf69b915feb7314ed487c77a42054f29e /test/files/neg/double-def-top-level.check
parent9e7988580c3e6b445bdae91ac39e275e5cc46afa (diff)
downloadscala-a6714f8fee2f8df9bc9d4760ed4c0c799f4f2c11.tar.gz
scala-a6714f8fee2f8df9bc9d4760ed4c0c799f4f2c11.tar.bz2
scala-a6714f8fee2f8df9bc9d4760ed4c0c799f4f2c11.zip
Eliminate some N^2 performance in type checking
Where N is the number of members of the enclosing package. Double definition errors for top level classes/objects are issued elsewhere, as demonstrated by the enclosed test. So we can omit the call to `checkNoDoubleDefs` in this content. We can't omit the call to `addSynthetics` for package class owners (case- and value-class synthetic companions are added here), but we can make the process cheaper by moving the expensive-but-usually-true call to `shouldAdd`. Here's an example of the improvement. % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time scalac-hash v2.11.0 -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala; real 0m49.762s user 1m12.376s sys 0m2.371s % rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala; real 0m35.662s user 0m58.275s sys 0m2.355s We've still got another source of pathological performance in creating nested scopes that I'll fix in the next commit.
Diffstat (limited to 'test/files/neg/double-def-top-level.check')
-rw-r--r--test/files/neg/double-def-top-level.check7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/neg/double-def-top-level.check b/test/files/neg/double-def-top-level.check
new file mode 100644
index 0000000000..85b16e81e5
--- /dev/null
+++ b/test/files/neg/double-def-top-level.check
@@ -0,0 +1,7 @@
+D_3.scala:1: error: C is already defined as class C
+class C
+ ^
+D_3.scala:2: error: O is already defined as object O
+object O
+ ^
+two errors found