Commit b5b4aae4 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Wibble to fix of Trac #5439: deal with the error-recovery case

Even if we are recovering from a typecheck error, we should still do
the right thing for the "closed" flag.  Otherwise we get an assert
failure, and potentially different behaviour when the user fixes
the original type error.
parent fa71e6c7
......@@ -716,12 +716,15 @@ recoveryCode :: [Name] -> SigFun -> TcM (LHsBinds TcId, [Id], TopLevelFlag)
recoveryCode binder_names sig_fn
= do { traceTc "tcBindsWithSigs: error recovery" (ppr binder_names)
; poly_ids <- mapM mk_dummy binder_names
; return (emptyBag, poly_ids, TopLevel) }
; return (emptyBag, poly_ids, if all is_closed poly_ids
then TopLevel else NotTopLevel) }
mk_dummy name
| isJust (sig_fn name) = tcLookupId name -- Had signature; look it up
| otherwise = return (mkLocalId name forall_a_a) -- No signature
is_closed poly_id = isEmptyVarSet (tyVarsOfType (idType poly_id))
forall_a_a :: TcType
forall_a_a = mkForAllTy openAlphaTyVar (mkTyVarTy openAlphaTyVar)
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