summaryrefslogtreecommitdiff
path: root/test/files/pos/t6976/ImplicitBug_1.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-16 15:11:31 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-01-16 16:09:10 +0100
commitd9d6494fa7704ebacfa74e92a964381895bbf8d4 (patch)
treea299b9ab3813e57a6bdb925f4ed130489ed79675 /test/files/pos/t6976/ImplicitBug_1.scala
parent766bb97114b5932b75340a9169558de61899997e (diff)
downloadscala-d9d6494fa7704ebacfa74e92a964381895bbf8d4.tar.gz
scala-d9d6494fa7704ebacfa74e92a964381895bbf8d4.tar.bz2
scala-d9d6494fa7704ebacfa74e92a964381895bbf8d4.zip
SI-6976 Fix value class separate compilation crasher.
We can't guarantee that the owner of the value class is initialized, and if it isn't, the search for the companion module will turn up bubkis. This is a localized fix, but I'd be suprised if there weren't other places that suffered from the same problem. Wouldn't it be nicer to have something like: // doesn't force info sym.raw.info sym.raw.companionModule // forces info sym.info sym.companionModule
Diffstat (limited to 'test/files/pos/t6976/ImplicitBug_1.scala')
-rw-r--r--test/files/pos/t6976/ImplicitBug_1.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/files/pos/t6976/ImplicitBug_1.scala b/test/files/pos/t6976/ImplicitBug_1.scala
new file mode 100644
index 0000000000..c9031bab2e
--- /dev/null
+++ b/test/files/pos/t6976/ImplicitBug_1.scala
@@ -0,0 +1,27 @@
+// This one is weird and nasty. Not sure if this is scalac or sbt
+// (tried with 0.12 & 0.12.2-RC2) bug.
+//
+// A level of indirection is required to trigger this bug.
+// Exts seems to need to be defined in separate file.
+//
+// Steps to reproduce:
+// 1. sbt clean
+// 2. sbt run (it works)
+// 3. Comment A & uncomment B.
+// 4. sbt run (it fails)
+// 5. Switch it back & sbt run. It still fails.
+//
+// In this project sbt clean helps. However in a large project where this
+// bug was found compiler crashed even after doing sbt clean. The only
+// way to work around this was to reference Exts object explicitly (C) in
+// the source file using its implicit classes.
+
+// Lets suppose this is a mega-trait combining all sorts of helper
+// functionality.
+trait Support extends Exts
+
+object ImplicitsBug extends App with Support { // A
+// object ImplicitsBug extends App with Exts { // B
+ //Exts // C) this reference helped in the large project.
+ println(3.moo)
+}