diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-12-02 01:08:59 -0800 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-04-07 12:00:16 -0700 |
commit | 1d5c887ca0e6d1332c2655d73fab0dc72c53530d (patch) | |
tree | 33b645cb62e8ec1fc01d157b37fd5d4fbc5b3eda | |
parent | 9e7802fc0c305b9b971000ddf69e717defc9d8b5 (diff) | |
download | haskell-1d5c887ca0e6d1332c2655d73fab0dc72c53530d.tar.gz |
Axe one-shot sig-of
Summary:
We're getting rid of -sig-of foo:A usage, because
it doesn't make sense in any compilation mode besides one-shot,
and we don't expect users to use it anyway.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D789
-rw-r--r-- | compiler/main/DynFlags.hs | 18 | ||||
-rw-r--r-- | docs/users_guide/separate_compilation.xml | 10 | ||||
-rw-r--r-- | testsuite/tests/driver/recomp014/Makefile | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/sigof01/Makefile | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/sigof02/Makefile | 8 | ||||
-rw-r--r-- | testsuite/tests/driver/sigof03/Makefile | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/sigof04/Makefile | 2 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 8 |
9 files changed, 25 insertions, 33 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 0dc25e382d..bd204574de 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -51,7 +51,7 @@ module DynFlags ( fFlags, fWarningFlags, fLangFlags, xFlags, dynFlagDependencies, tablesNextToCode, mkTablesNextToCode, - SigOf(..), getSigOf, + SigOf, getSigOf, Way(..), mkBuildTag, wayRTSOnly, addWay', updateWays, wayGeneralFlags, wayUnsetGeneralFlags, @@ -643,16 +643,10 @@ data ExtensionFlag | Opt_StaticPointers deriving (Eq, Enum, Show) -data SigOf = NotSigOf - | SigOf Module - | SigOfMap (Map ModuleName Module) +type SigOf = Map ModuleName Module getSigOf :: DynFlags -> ModuleName -> Maybe Module -getSigOf dflags n = - case sigOf dflags of - NotSigOf -> Nothing - SigOf m -> Just m - SigOfMap m -> Map.lookup n m +getSigOf dflags n = Map.lookup n (sigOf dflags) -- | Contains not only a collection of 'GeneralFlag's but also a plethora of -- information relating to the compilation of a single file or GHC session @@ -1414,7 +1408,7 @@ defaultDynFlags mySettings = ghcMode = CompManager, ghcLink = LinkBinary, hscTarget = defaultHscTarget (sTargetPlatform mySettings), - sigOf = NotSigOf, + sigOf = Map.empty, verbosity = 0, optLevel = 0, simplPhases = 2, @@ -1918,9 +1912,7 @@ parseSigOf :: String -> SigOf parseSigOf str = case filter ((=="").snd) (readP_to_S parse str) of [(r, "")] -> r _ -> throwGhcException $ CmdLineError ("Can't parse -sig-of: " ++ str) - where parse = parseOne +++ parseMany - parseOne = SigOf `fmap` parseModule - parseMany = SigOfMap . Map.fromList <$> sepBy parseEntry (R.char ',') + where parse = Map.fromList <$> sepBy parseEntry (R.char ',') parseEntry = do n <- tok $ parseModuleName -- ToDo: deprecate this 'is' syntax? diff --git a/docs/users_guide/separate_compilation.xml b/docs/users_guide/separate_compilation.xml index 32422caedc..07cf76c6c7 100644 --- a/docs/users_guide/separate_compilation.xml +++ b/docs/users_guide/separate_compilation.xml @@ -941,14 +941,14 @@ module A where <programlisting> ghc -c Text.hs -ghc -c TextSig.hsig -sig-of main:Text +ghc -c TextSig.hsig -sig-of "TextSig is main:Text" ghc -c A.hs </programlisting> - <para>Signature files can also be compiled as part of - <literal>--make</literal>, in which case the syntax is extended - to support specifying implementations of multiple signatures - as <literal>FooSig is main:Foo, BarSig is main:Bar</literal>. + <para>To specify multiple signatures, use a comma-separated list. + The <literal>-sig-of</literal> parameter is required to specify + the backing implementations of all home modules, even in one-shot + compilation mode. At the moment, you must specify the full module name (package key, colon, and then module name), although in the future we may support more user-friendly syntax.</para> diff --git a/testsuite/tests/driver/recomp014/Makefile b/testsuite/tests/driver/recomp014/Makefile index c9ba0e05bd..e788110097 100644 --- a/testsuite/tests/driver/recomp014/Makefile +++ b/testsuite/tests/driver/recomp014/Makefile @@ -18,12 +18,12 @@ recomp014: clean echo 'first run' '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c A.hs '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c A1.hs - '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of main:A + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of "B is main:A" echo 'import B; main = print a' > C.hs '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c C.hs '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c C.hs echo 'second run' - '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of main:A1 + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of "B is main:A1" '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c C.hs '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) A1.o C.o -o recomp014 ./recomp014 diff --git a/testsuite/tests/driver/sigof01/Makefile b/testsuite/tests/driver/sigof01/Makefile index 8e373e749e..629d4b656a 100644 --- a/testsuite/tests/driver/sigof01/Makefile +++ b/testsuite/tests/driver/sigof01/Makefile @@ -11,7 +11,7 @@ sigof01: rm -rf tmp_sigof01 mkdir tmp_sigof01 '$(TEST_HC)' $(S01_OPTS) -c A.hs - '$(TEST_HC)' $(S01_OPTS) -c B.hsig -sig-of main:A + '$(TEST_HC)' $(S01_OPTS) -c B.hsig -sig-of "B is main:A" '$(TEST_HC)' $(S01_OPTS) -c Main.hs '$(TEST_HC)' $(S01_OPTS) tmp_sigof01/A.o tmp_sigof01/Main.o -o tmp_sigof01/Main tmp_sigof01/Main diff --git a/testsuite/tests/driver/sigof02/Makefile b/testsuite/tests/driver/sigof02/Makefile index 9a64ec220b..8f153f44ce 100644 --- a/testsuite/tests/driver/sigof02/Makefile +++ b/testsuite/tests/driver/sigof02/Makefile @@ -11,11 +11,11 @@ sigof02: rm -rf tmp_sigof02 mkdir tmp_sigof02 '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02/containers - '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02/containers`:Data.Map.Strict" + '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "Map is `cat tmp_sigof02/containers`:Data.Map.Strict" '$(TEST_HC)' $(S02_OPTS) -c Main.hs '$(TEST_HC)' $(S02_OPTS) -package containers tmp_sigof02/Main.o -o tmp_sigof02/StrictMain ! ./tmp_sigof02/StrictMain - '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02/containers`:Data.Map.Lazy" + '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "Map is `cat tmp_sigof02/containers`:Data.Map.Lazy" '$(TEST_HC)' $(S02_OPTS) -c Main.hs '$(TEST_HC)' $(S02_OPTS) -package containers tmp_sigof02/Main.o -o tmp_sigof02/LazyMain ./tmp_sigof02/LazyMain @@ -47,8 +47,8 @@ sigof02d: rm -rf tmp_sigof02d mkdir tmp_sigof02d '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02d/containers - '$(TEST_HC)' $(S02D_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02d/containers`:Data.Map.Lazy" - '$(TEST_HC)' $(S02D_OPTS) -c MapAsSet.hsig -sig-of "`cat tmp_sigof02d/containers`:Data.Map.Lazy" + '$(TEST_HC)' $(S02D_OPTS) -c Map.hsig -sig-of "Map is `cat tmp_sigof02d/containers`:Data.Map.Lazy, MapAsSet is `cat tmp_sigof02d/containers`:Data.Map.Lazy" + '$(TEST_HC)' $(S02D_OPTS) -c MapAsSet.hsig -sig-of "Map is `cat tmp_sigof02d/containers`:Data.Map.Lazy, MapAsSet is `cat tmp_sigof02d/containers`:Data.Map.Lazy" '$(TEST_HC)' $(S02D_OPTS) -c Double.hs '$(TEST_HC)' $(S02D_OPTS) -package containers tmp_sigof02d/Main.o -o tmp_sigof02d/Double ./tmp_sigof02d/Double diff --git a/testsuite/tests/driver/sigof03/Makefile b/testsuite/tests/driver/sigof03/Makefile index 28c59805aa..03a0b9b2da 100644 --- a/testsuite/tests/driver/sigof03/Makefile +++ b/testsuite/tests/driver/sigof03/Makefile @@ -11,8 +11,8 @@ sigof03: rm -rf tmp_sigof03 mkdir tmp_sigof03 '$(TEST_HC)' $(S03_OPTS) -c A.hs - '$(TEST_HC)' $(S03_OPTS) -c ASig1.hsig -sig-of main:A - '$(TEST_HC)' $(S03_OPTS) -c ASig2.hsig -sig-of main:A + '$(TEST_HC)' $(S03_OPTS) -c ASig1.hsig -sig-of "ASig1 is main:A, ASig2 is main:A" + '$(TEST_HC)' $(S03_OPTS) -c ASig2.hsig -sig-of "ASig1 is main:A, ASig2 is main:A" '$(TEST_HC)' $(S03_OPTS) -c Main.hs '$(TEST_HC)' $(S03_OPTS) tmp_sigof03/A.o tmp_sigof03/Main.o -o tmp_sigof03/Main ./tmp_sigof03/Main diff --git a/testsuite/tests/driver/sigof04/Makefile b/testsuite/tests/driver/sigof04/Makefile index e68d7b6bfc..f013b0c202 100644 --- a/testsuite/tests/driver/sigof04/Makefile +++ b/testsuite/tests/driver/sigof04/Makefile @@ -11,4 +11,4 @@ clean: sigof04: '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > containers - ! '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c Sig.hsig -sig-of "`cat containers`:Data.Map.Strict" + ! '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c Sig.hsig -sig-of "Sig is `cat containers`:Data.Map.Strict" diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index ab0a3fec8b..827811faf5 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -357,7 +357,7 @@ test('tc262', normal, compile, ['']) test('tc263', extra_clean(['Tc263_Help.o','Tc263_Help.hi']), multimod_compile, ['tc263','-v0']) -test('tc264', normal, multimod_compile, ['tc264.hsig', '-sig-of base:Data.STRef']) +test('tc264', normal, multimod_compile, ['tc264.hsig', '-sig-of "ShouldCompile is base:Data.STRef"']) test('GivenOverlapping', normal, compile, ['']) test('GivenTypeSynonym', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index ea53e39d69..9b71388af4 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -242,10 +242,10 @@ test('tcfail215', normal, compile_fail, ['']) test('tcfail216', normal, compile_fail, ['']) test('tcfail217', normal, compile_fail, ['']) test('tcfail218', normal, compile_fail, ['']) -test('tcfail219', normal, multimod_compile_fail, ['tcfail219.hsig', '-sig-of base:Data.Bool']) -test('tcfail220', normal, multimod_compile_fail, ['tcfail220.hsig', '-sig-of base:Prelude']) -test('tcfail221', normal, multimod_compile_fail, ['tcfail221.hsig', '-sig-of base:Prelude']) -test('tcfail222', normal, multimod_compile_fail, ['tcfail222.hsig', '-sig-of base:Data.STRef']) +test('tcfail219', normal, multimod_compile_fail, ['tcfail219.hsig', '-sig-of "ShouldFail is base:Data.Bool"']) +test('tcfail220', normal, multimod_compile_fail, ['tcfail220.hsig', '-sig-of "ShouldFail is base:Prelude"']) +test('tcfail221', normal, multimod_compile_fail, ['tcfail221.hsig', '-sig-of "ShouldFail is base:Prelude"']) +test('tcfail222', normal, multimod_compile_fail, ['tcfail222.hsig', '-sig-of "ShouldFail is base:Data.STRef"']) test('SilentParametersOverlapping', normal, compile, ['']) test('FailDueToGivenOverlapping', normal, compile_fail, ['']) |