Skip to content

Commit 416abb7

Browse files
committed
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`).
1 parent 94c63f5 commit 416abb7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compiler/scala/tools/nsc/settings/ScalaSettings.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ trait ScalaSettings extends AbsScalaSettings
4141
protected def optimiseSettings = List[BooleanSetting](inline, inlineHandlers, Xcloselim, Xdce)
4242

4343
/** Internal use - syntax enhancements. */
44-
private class EnableSettings[T <: Setting](val s: T) {
45-
def enabling(toEnable: List[BooleanSetting]): s.type = s withPostSetHook (_ => toEnable foreach (_.value = true))
44+
private class EnableSettings[T <: BooleanSetting](val s: T) {
45+
def enabling(toEnable: List[BooleanSetting]): s.type = s withPostSetHook (_ => toEnable foreach (_.value = s.value))
4646
def andThen(f: s.T => Unit): s.type = s withPostSetHook (setting => f(setting.value))
4747
}
48-
private implicit def installEnableSettings[T <: Setting](s: T) = new EnableSettings(s)
48+
private implicit def installEnableSettings[T <: BooleanSetting](s: T) = new EnableSettings(s)
4949

5050
/** Disable a setting */
5151
def disable(s: Setting) = allSettings -= s

0 commit comments

Comments
 (0)