diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-04-30 12:42:08 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-05-03 21:54:50 +0300 |
commit | 87bc954ab65aaf08b4f59cf46bd2916acd69ea73 (patch) | |
tree | c0cc47d6255e6939ed58f86e8ac5c43fd20b0942 /compiler/iface | |
parent | 9b59e126f541a7dadd5157334531d4bc68a5445b (diff) | |
download | haskell-87bc954ab65aaf08b4f59cf46bd2916acd69ea73.tar.gz |
Fix interface version number printing in --show-iface
Before
Version: Wanted [8, 0, 9, 0, 2, 0, 1, 9, 0, 4, 2, 5],
got [8, 0, 9, 0, 2, 0, 1, 9, 0, 4, 2, 5]
After
Version: Wanted 809020190425,
got 809020190425
Diffstat (limited to 'compiler/iface')
-rw-r--r-- | compiler/iface/BinIface.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs index 4e226854d6..e365a8edd4 100644 --- a/compiler/iface/BinIface.hs +++ b/compiler/iface/BinIface.hs @@ -92,11 +92,12 @@ readBinIface_ dflags checkHiWay traceBinIFaceReading hi_path ncu = do (defaultDumpStyle dflags) sd QuietBinIFaceReading -> \_ -> return () - wantedGot :: Outputable a => String -> a -> a -> IO () - wantedGot what wanted got = + + wantedGot :: String -> a -> a -> (a -> SDoc) -> IO () + wantedGot what wanted got ppr' = printer (text what <> text ": " <> - vcat [text "Wanted " <> ppr wanted <> text ",", - text "got " <> ppr got]) + vcat [text "Wanted " <> ppr' wanted <> text ",", + text "got " <> ppr' got]) errorOnMismatch :: (Eq a, Show a) => String -> a -> a -> IO () errorOnMismatch what wanted got = @@ -111,7 +112,7 @@ readBinIface_ dflags checkHiWay traceBinIFaceReading hi_path ncu = do -- (This magic number does not change when we change -- GHC interface file format) magic <- get bh - wantedGot "Magic" (binaryInterfaceMagic dflags) magic + wantedGot "Magic" (binaryInterfaceMagic dflags) magic ppr errorOnMismatch "magic number mismatch: old/corrupt interface file?" (binaryInterfaceMagic dflags) magic @@ -129,12 +130,12 @@ readBinIface_ dflags checkHiWay traceBinIFaceReading hi_path ncu = do -- Check the interface file version and ways. check_ver <- get bh let our_ver = show hiVersion - wantedGot "Version" our_ver check_ver + wantedGot "Version" our_ver check_ver text errorOnMismatch "mismatched interface file versions" our_ver check_ver check_way <- get bh let way_descr = getWayDescr dflags - wantedGot "Way" way_descr check_way + wantedGot "Way" way_descr check_way ppr when (checkHiWay == CheckHiWay) $ errorOnMismatch "mismatched interface file ways" way_descr check_way getWithUserData ncu bh |