DynFlags: Don't panic on incompatible Safe Haskell flags
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 16 Feb 2016 21:45:57 +0000 (22:45 +0100)
committerBen Gamari <ben@smart-cactus.org>
Tue, 16 Feb 2016 21:46:06 +0000 (22:46 +0100)
We just return an arbitrary value since we are destined to fail due to
the error anyways.

Fixes #11580.

Test Plan: Needs to be tested

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1925

GHC Trac Issues: #11580

compiler/main/DynFlags.hs

index 6460b16..52da300 100644 (file)
@@ -1886,7 +1886,7 @@ combineSafeFlags :: SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode
 combineSafeFlags a b | a == Sf_None         = return b
                      | b == Sf_None         = return a
                      | a == b               = return a
-                     | otherwise            = addErr errm >> return (panic errm)
+                     | otherwise            = addErr errm >> pure a
     where errm = "Incompatible Safe Haskell flags! ("
                     ++ show a ++ ", " ++ show b ++ ")"