Open RyanGlScott opened 7 years ago
Now that I look closer at the actual error that this emits (elimList is already defined
), the diagnosis is actually spot-on—the only sketchy part is the bit about it being an "INTERNAL
" error. Given that this error message is actually quite feasible to trigger in practice, would a suitable resolution to this bug simply be to change the severity of the error? For example, if you apply this patch:
diff --git a/src/Idris/Elab/Term.hs b/src/Idris/Elab/Term.hs
index 2908a9c..d320764 100644
--- a/src/Idris/Elab/Term.hs
+++ b/src/Idris/Elab/Term.hs
@@ -1846,7 +1846,7 @@ runElabAction info ist fc env tm ns = do tm' <- eval tm
mustNotBeDefined ctxt n =
case lookupDefExact n ctxt of
- Just _ -> lift . tfail . InternalMsg $
+ Just _ -> lift . tfail . Msg $
show n ++ " is already defined."
Nothing -> return ()
Then the error becomes this:
*Pruviloj/Derive/Eliminators> :let %runElab (deriveElim `{{List}} `{{elimList}})
*Pruviloj/Derive/Eliminators> :let %runElab (deriveElim `{{List}} `{{elimList}})
(input):1:6-13: While running an elaboration script, the following error occurred:
elimList is already defined.
That doesn't have any connotations of being an error that can only be triggered internally. I'm not familiar with the Idris codebase's conventions for which errors should have which severities, so I'm not sure if this is the right approach.