Commit 56edf70a authored by simonpj's avatar simonpj

[project @ 2004-03-11 10:52:55 by simonpj]

Fix a long-standing bug; the type checker should recover from a failure
in the default method of a class declaration, else the default method
doesn't get added to the type envt, and we get an opaque
	    tcLookupGlobal: `FunnyError.$dmb' is not in scope
message.
parent 798614f1
......@@ -336,7 +336,13 @@ tcMethodBind
tcMethodBind xtve inst_tyvars inst_theta avail_insts prags
(sel_id, meth_id, meth_bind)
= -- Check the bindings; first adding inst_tyvars to the envt
= recoverM (returnM emptyBag) $
-- If anything fails, recover returning no bindings.
-- This is particularly useful when checking the default-method binding of
-- a class decl. If we don't recover, we don't add the default method to
-- the type enviroment, and we get a tcLookup failure on $dmeth later.
-- Check the bindings; first adding inst_tyvars to the envt
-- so that we don't quantify over them in nested places
mkTcSig meth_id `thenM` \ meth_sig ->
......
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