Commit 1d5c887c authored by Edward Z. Yang's avatar Edward Z. Yang

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: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D789
parent 9e7802fc
......@@ -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?
......
......@@ -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>
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......@@ -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, [''])
......
......@@ -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, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment