src/HOL/Tools/record_package.ML
changeset 19750 5281bd607206
parent 19748 5d05d091eecb
child 19841 f2fa72c13186
equal deleted inserted replaced
19749:a49881f91cce 19750:5281bd607206
   581                                           Envir.norm_type subst o varifyT)
   581                                           Envir.norm_type subst o varifyT)
   582                                          (but_last alphas);
   582                                          (but_last alphas);
   583 
   583 
   584                        val more' = mk_ext rest;
   584                        val more' = mk_ext rest;
   585                      in list_comb (Syntax.const (suffix sfx ext),alphas'@[more'])
   585                      in list_comb (Syntax.const (suffix sfx ext),alphas'@[more'])
   586                      end handle TUNIFY => raise
   586                      end handle TYPE_MATCH => raise
   587                            TERM (msg ^ "type is no proper record (extension)", [t]))
   587                            TERM (msg ^ "type is no proper record (extension)", [t]))
   588                | NONE => raise TERM (msg ^ "no fields defined for " ^ ext,[t]))
   588                | NONE => raise TERM (msg ^ "no fields defined for " ^ ext,[t]))
   589           | NONE => raise TERM (msg ^ name ^" is no proper field",[t]))
   589           | NONE => raise TERM (msg ^ name ^" is no proper field",[t]))
   590       | mk_ext [] = more
   590       | mk_ext [] = more
   591 
   591 
   737                      val subst = match schemeT T
   737                      val subst = match schemeT T
   738                    in
   738                    in
   739                     if HOLogic.is_unitT (Envir.norm_type subst (varifyT (TFree(zeta,Sign.defaultS thy))))
   739                     if HOLogic.is_unitT (Envir.norm_type subst (varifyT (TFree(zeta,Sign.defaultS thy))))
   740                     then mk_type_abbr subst abbr alphas
   740                     then mk_type_abbr subst abbr alphas
   741                     else mk_type_abbr subst (suffix schemeN abbr) (alphas@[zeta])
   741                     else mk_type_abbr subst (suffix schemeN abbr) (alphas@[zeta])
   742                    end handle TUNIFY => default_tr' context tm)
   742                    end handle TYPE_MATCH => default_tr' context tm)
   743                  else raise Match (* give print translation of specialised record a chance *)
   743                  else raise Match (* give print translation of specialised record a chance *)
   744             | _ => raise Match)
   744             | _ => raise Match)
   745        else default_tr' context tm
   745        else default_tr' context tm
   746   end
   746   end
   747 
   747 
   773                                 val subst= fold (Sign.typ_match thy) (alphavars~~args')
   773                                 val subst= fold (Sign.typ_match thy) (alphavars~~args')
   774                                                     Vartab.empty;
   774                                                     Vartab.empty;
   775                                 val flds'' =map (apsnd (Envir.norm_type subst o varifyT))
   775                                 val flds'' =map (apsnd (Envir.norm_type subst o varifyT))
   776                                                 flds';
   776                                                 flds';
   777                               in flds''@field_lst more end
   777                               in flds''@field_lst more end
   778                               handle TUNIFY         => [("",T)]
   778                               handle TYPE_MATCH     => [("",T)]
   779                                    | UnequalLengths => [("",T)])
   779                                    | UnequalLengths => [("",T)])
   780                          | NONE => [("",T)])
   780                          | NONE => [("",T)])
   781                    | NONE => [("",T)])
   781                    | NONE => [("",T)])
   782              | NONE => [("",T)])
   782              | NONE => [("",T)])
   783         | _ => [("",T)])
   783         | _ => [("",T)])