--- a/src/Pure/Isar/proof_context.ML Wed Jan 10 13:37:29 2024 +0100
+++ b/src/Pure/Isar/proof_context.ML Wed Jan 10 13:43:10 2024 +0100
@@ -533,13 +533,10 @@
else
let
val ((d, reports), decl) = Type.check_decl (Context.Proof ctxt) (tsig_of ctxt) (c, pos);
- fun err () = error ("Bad type name: " ^ quote d ^ Position.here pos);
- val args =
- (case decl of
- Type.Logical_Type n => n
- | Type.Abbreviation (vs, _, _) => if strict then err () else length vs
- | Type.Nonterminal => if strict then err () else 0);
- in (Type (d, replicate args dummyT), reports) end;
+ val _ =
+ if strict andalso not (Type.decl_logical decl)
+ then error ("Bad type name: " ^ quote d ^ Position.here pos) else ();
+ in (Type (d, replicate (Type.decl_args decl) dummyT), reports) end;
fun read_type_name flags ctxt text =
let
--- a/src/Pure/type.ML Wed Jan 10 13:37:29 2024 +0100
+++ b/src/Pure/type.ML Wed Jan 10 13:43:10 2024 +0100
@@ -18,6 +18,8 @@
Logical_Type of int |
Abbreviation of string list * typ * bool |
Nonterminal
+ val decl_args: decl -> int
+ val decl_logical: decl -> bool
type tsig
val eq_tsig: tsig * tsig -> bool
val rep_tsig: tsig ->
@@ -161,6 +163,9 @@
| decl_args (Abbreviation (vs, _, _)) = length vs
| decl_args Nonterminal = 0;
+fun decl_logical (Logical_Type _) = true
+ | decl_logical _ = false;
+
(* type tsig *)