18ae43d00fe535ef1720ac8314bc7dec45b23c99
[gentoo.git] /
1 diff -r dd611ab202a8 -r e7e647949c95 src/HOL/Tools/Function/fun.ML
2 --- a/src/HOL/Tools/Function/fun.ML     Wed Jun 06 10:35:05 2012 +0200
3 +++ b/src/HOL/Tools/Function/fun.ML     Wed Jun 06 21:36:21 2012 +0200
4 @@ -84,10 +84,10 @@
5      spec @ mk_catchall fixes arity_of
6    end
7  
8 -fun warnings ctxt origs tss =
9 +fun further_checks ctxt origs tss =
10    let
11 -    fun warn_redundant t =
12 -      warning ("Ignoring redundant equation: " ^ quote (Syntax.string_of_term ctxt t))
13 +    fun fail_redundant t =
14 +      error (cat_lines ["Equation is redundant (covered by preceding clauses):", Syntax.string_of_term ctxt t])
15      fun warn_missing strs =
16        warning (cat_lines ("Missing patterns in function definition:" :: strs))
17  
18 @@ -100,7 +100,7 @@
19           @ ["(" ^ string_of_int (length rest) ^ " more)"])
20  
21      val _ = (origs ~~ tss')
22 -      |> map (fn (t, ts) => if null ts then warn_redundant t else ())
23 +      |> map (fn (t, ts) => if null ts then fail_redundant t else ())
24    in
25      ()
26    end
27 @@ -119,7 +119,7 @@
28        val compleqs = add_catchall ctxt fixes feqs (* Completion *)
29  
30        val spliteqs = Function_Split.split_all_equations ctxt compleqs
31 -        |> tap (warnings ctxt feqs)
32 +        |> tap (further_checks ctxt feqs)
33  
34        fun restore_spec thms =
35          bnds ~~ take (length bnds) (unflat spliteqs thms)