diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2012-04-30 11:46:33 +0200 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2012-04-30 12:12:59 +0200 |
commit | 416abb70256267ccb80b7f5b6d205c9f384a14e0 (patch) | |
tree | 8899c35ca481b39f9825764cccd7b245ad5faac1 /src | |
parent | 94c63f5da548996535cad43142758c9405118828 (diff) | |
download | scala-416abb70256267ccb80b7f5b6d205c9f384a14e0.tar.gz scala-416abb70256267ccb80b7f5b6d205c9f384a14e0.tar.bz2 scala-416abb70256267ccb80b7f5b6d205c9f384a14e0.zip |
Fixed `Setting.enabling` to properly disable dependent settings when the original setting is set to `false`.
This can be witnessed in the IDE, when explicitly setting the `-optimize` flag to false leads to setting all the dependent flags to true (`-Yinline`, `-Ydce`, `-Ycloselim`).
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 91e31cae97..0a9d25af7e 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -41,11 +41,11 @@ trait ScalaSettings extends AbsScalaSettings protected def optimiseSettings = List[BooleanSetting](inline, inlineHandlers, Xcloselim, Xdce) /** Internal use - syntax enhancements. */ - private class EnableSettings[T <: Setting](val s: T) { - def enabling(toEnable: List[BooleanSetting]): s.type = s withPostSetHook (_ => toEnable foreach (_.value = true)) + private class EnableSettings[T <: BooleanSetting](val s: T) { + def enabling(toEnable: List[BooleanSetting]): s.type = s withPostSetHook (_ => toEnable foreach (_.value = s.value)) def andThen(f: s.T => Unit): s.type = s withPostSetHook (setting => f(setting.value)) } - private implicit def installEnableSettings[T <: Setting](s: T) = new EnableSettings(s) + private implicit def installEnableSettings[T <: BooleanSetting](s: T) = new EnableSettings(s) /** Disable a setting */ def disable(s: Setting) = allSettings -= s |