summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-09-28 20:49:29 +0000
committerPaul Phillips <paulp@improving.org>2011-09-28 20:49:29 +0000
commit82eb1aa430195648b6fe80f67c45c741884dc2d7 (patch)
tree1a6b52bdd181d571e5f773942b3c1aa04a04d99a /src/compiler/scala/reflect/internal/settings/MutableSettings.scala
parent26ddf17b21f289bba1ac76db7d5df54af306e75b (diff)
downloadscala-82eb1aa430195648b6fe80f67c45c741884dc2d7.tar.gz
scala-82eb1aa430195648b6fe80f67c45c741884dc2d7.tar.bz2
scala-82eb1aa430195648b6fe80f67c45c741884dc2d7.zip
Hand specialized SettingValue.
Discovered every time we do something like if (settings.debug.value) the boolean is coming out of a box. How uncouth. To fix this, I had to make the storage abstract, so concrete setting types have to declare the storage personally. This seems a small price to pay. I tried to use specialization but I think it's impossible to get the type parameter and the abstract type to agree with one another when mr. invariant var is the object of your affection, without scalac putting the kibosh on the whole adventure. No review.
Diffstat (limited to 'src/compiler/scala/reflect/internal/settings/MutableSettings.scala')
-rw-r--r--src/compiler/scala/reflect/internal/settings/MutableSettings.scala26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/compiler/scala/reflect/internal/settings/MutableSettings.scala b/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
index 3bf296760f..b756408541 100644
--- a/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
+++ b/src/compiler/scala/reflect/internal/settings/MutableSettings.scala
@@ -12,10 +12,12 @@ package settings
abstract class MutableSettings extends AbsSettings {
type Setting <: SettingValue
+ type BooleanSetting <: Setting { type T = Boolean }
+ type IntSetting <: Setting { type T = Int }
// basically this is a value which remembers if it's been modified
trait SettingValue extends AbsSettingValue {
- protected var v: T = _
+ protected var v: T
protected var setByUser: Boolean = false
def postSetHook(): Unit = ()
@@ -29,15 +31,15 @@ abstract class MutableSettings extends AbsSettings {
}
}
- def overrideObjects: SettingValue { type T = Boolean }
- def printtypes: SettingValue { type T = Boolean }
- def debug: SettingValue { type T = Boolean }
- def YdepMethTpes: SettingValue { type T = Boolean }
- def Ynotnull: SettingValue { type T = Boolean }
- def explaintypes: SettingValue { type T = Boolean }
- def verbose: SettingValue { type T = Boolean }
- def uniqid: SettingValue { type T = Boolean }
- def Xprintpos: SettingValue { type T = Boolean }
- def Yrecursion: SettingValue { type T = Int }
- def maxClassfileName: SettingValue { type T = Int }
+ def overrideObjects: BooleanSetting
+ def printtypes: BooleanSetting
+ def debug: BooleanSetting
+ def YdepMethTpes: BooleanSetting
+ def Ynotnull: BooleanSetting
+ def explaintypes: BooleanSetting
+ def verbose: BooleanSetting
+ def uniqid: BooleanSetting
+ def Xprintpos: BooleanSetting
+ def Yrecursion: IntSetting
+ def maxClassfileName: IntSetting
} \ No newline at end of file