From 67fc825363956461753e827b1c03cfb17cf87462 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Fri, 19 Feb 2016 20:00:10 +0100 Subject: [PATCH] Fix parsing of the 'allow-newer' config field. Was accidentally broken in #3165. --- cabal-install/Distribution/Client/Config.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cabal-install/Distribution/Client/Config.hs b/cabal-install/Distribution/Client/Config.hs index edbeffedc9b..96cc0445bf7 100644 --- a/cabal-install/Distribution/Client/Config.hs +++ b/cabal-install/Distribution/Client/Config.hs @@ -62,6 +62,7 @@ import Distribution.Simple.Compiler ( DebugInfoLevel(..), OptimisationLevel(..) ) import Distribution.Simple.Setup ( ConfigFlags(..), configureOptions, defaultConfigFlags + , AllowNewer(..), isAllowNewer , HaddockFlags(..), haddockOptions, defaultHaddockFlags , installDirsOptions, optionDistPref , programConfigurationPaths', programConfigurationOptions @@ -74,7 +75,7 @@ import Distribution.ParseUtils , ParseResult(..), PError(..), PWarning(..) , locatedErrorMsg, showPWarning , readFields, warning, lineNo - , simpleField, listField, spaceListField + , simpleField, boolField, listField, spaceListField , parseFilePathQ, parseTokenQ ) import Distribution.Client.ParseUtils ( parseFields, ppFields, ppSection ) @@ -668,6 +669,10 @@ configFieldDescriptions src = [simpleField "compiler" (fromFlagOrDefault Disp.empty . fmap Text.disp) (optional Text.parse) configHcFlavor (\v flags -> flags { configHcFlavor = v }) + ,let toAllowNewer True = AllowNewerAll + toAllowNewer False = AllowNewerNone in + boolField "allow-newer" (isAllowNewer . configAllowNewer) + (\v flags -> flags { configAllowNewer = toAllowNewer v }) -- TODO: The following is a temporary fix. The "optimization" -- and "debug-info" fields are OptArg, and viewAsFieldDescr -- fails on that. Instead of a hand-written hackaged parser