summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-01-13 20:33:52 -0800
committerJames Iry <jamesiry@gmail.com>2013-01-13 20:39:13 -0800
commit3ef487ecb6733bfe3c13d89780ebcfc81f9a5ea0 (patch)
tree05816010e6607a5495c25010e4bca6836d960281 /src/reflect
parent5d65772762072aa950a488c666673dc248b01d6d (diff)
downloadscala-3ef487ecb6733bfe3c13d89780ebcfc81f9a5ea0.tar.gz
scala-3ef487ecb6733bfe3c13d89780ebcfc81f9a5ea0.tar.bz2
scala-3ef487ecb6733bfe3c13d89780ebcfc81f9a5ea0.zip
SI-5954 Implementation restriction preventing companions in package objs
Companion objects (and thus also case classes) in package objects caused an assert about an overloaded symbol when everything was compiled twice. It's a hairy problem that doesn't fit in 2.10.1. So this fix adds an implementation restriction. It also has a test to make sure the error messages are clean and reasonably friendly, and does not catch other things defined in package objects. The test includes a commented out test in case somebody thinks they've solved the underlying problem. A handful of tests were falling afoul of the new implementation restriction. I verified that they do in fact fail on second compile so they aren't false casualties. But they do test real things we'd like to work once the re-compile issue is fixed. So I added a -X flag to disable the implementation restriction and made all the tests accidentally clobbered by the restriction use that flag.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/settings/MutableSettings.scala2
-rw-r--r--src/reflect/scala/reflect/runtime/Settings.scala1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/reflect/scala/reflect/internal/settings/MutableSettings.scala b/src/reflect/scala/reflect/internal/settings/MutableSettings.scala
index 81368df7a6..ec3501d5bc 100644
--- a/src/reflect/scala/reflect/internal/settings/MutableSettings.scala
+++ b/src/reflect/scala/reflect/internal/settings/MutableSettings.scala
@@ -47,4 +47,6 @@ abstract class MutableSettings extends AbsSettings {
def XoldPatmat: BooleanSetting
def XnoPatmatAnalysis: BooleanSetting
def XfullLubs: BooleanSetting
+ def companionsInPkgObjs: BooleanSetting
+
}
diff --git a/src/reflect/scala/reflect/runtime/Settings.scala b/src/reflect/scala/reflect/runtime/Settings.scala
index 0e0cf3fc40..2d5b76f094 100644
--- a/src/reflect/scala/reflect/runtime/Settings.scala
+++ b/src/reflect/scala/reflect/runtime/Settings.scala
@@ -43,6 +43,7 @@ private[reflect] class Settings extends MutableSettings {
val printtypes = new BooleanSetting(false)
val uniqid = new BooleanSetting(false)
val verbose = new BooleanSetting(false)
+ val companionsInPkgObjs = new BooleanSetting(false)
val Yrecursion = new IntSetting(0)
val maxClassfileName = new IntSetting(255)