summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/DynFlags.hs7
-rw-r--r--compiler/typecheck/TcTypeable.hs6
2 files changed, 9 insertions, 4 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index c4a917ff61..c2d0322cd9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -508,8 +508,9 @@ data GeneralFlag
| Opt_DoCmmLinting
| Opt_DoAsmLinting
| Opt_DoAnnotationLinting
- | Opt_NoLlvmMangler -- hidden flag
- | Opt_FastLlvm -- hidden flag
+ | Opt_NoLlvmMangler -- hidden flag
+ | Opt_FastLlvm -- hidden flag
+ | Opt_NoTypeableBinds
| Opt_WarnIsError -- -Werror; makes warnings fatal
| Opt_ShowWarnGroups -- Show the group a warning belongs to
@@ -3474,6 +3475,8 @@ dynamic_flags_deps = [
(NoArg (setGeneralFlag Opt_NoLlvmMangler)) -- hidden flag
, make_ord_flag defGhcFlag "fast-llvm"
(NoArg (setGeneralFlag Opt_FastLlvm)) -- hidden flag
+ , make_ord_flag defGhcFlag "dno-typeable-binds"
+ (NoArg (setGeneralFlag Opt_NoTypeableBinds))
, make_ord_flag defGhcFlag "ddump-debug"
(setDumpFlag Opt_D_dump_debug)
, make_ord_flag defGhcFlag "ddump-json"
diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs
index eb679e6daf..e2a0e66cd8 100644
--- a/compiler/typecheck/TcTypeable.hs
+++ b/compiler/typecheck/TcTypeable.hs
@@ -148,7 +148,9 @@ There are many wrinkles:
-- See Note [Grand plan for Typeable] in TcTypeable.
mkTypeableBinds :: TcM TcGblEnv
mkTypeableBinds
- = do { -- Create a binding for $trModule.
+ = do { dflags <- getDynFlags
+ ; if gopt Opt_NoTypeableBinds dflags then getGblEnv else do
+ { -- Create a binding for $trModule.
-- Do this before processing any data type declarations,
-- which need tcg_tr_module to be initialised
; tcg_env <- mkModIdBindings
@@ -166,7 +168,7 @@ mkTypeableBinds
; traceTc "mkTypeableBinds" (ppr tycons)
; this_mod_todos <- todoForTyCons mod mod_id tycons
; mkTypeRepTodoBinds (this_mod_todos : prim_todos)
- } }
+ } } }
where
needs_typeable_binds tc
| tc `elem` [runtimeRepTyCon, vecCountTyCon, vecElemTyCon]