Skip to content

Commit 90c9e41

Browse files
committed
Merge remote-tracking branch 'upstream/master' into econstr
2 parents 5c69490 + 286cf5c commit 90c9e41

File tree

1 file changed

+25
-38
lines changed

1 file changed

+25
-38
lines changed

mathcomp/ssreflect/plugin/trunk/ssreflect.ml4

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ let mkCExplVar loc id n =
262262
CAppExpl (loc, (None, Ident (loc, id), None), mkCHoles loc n)
263263
let mkCLambda loc name ty t =
264264
CLambdaN (loc, [[loc, name], Default Explicit, ty], t)
265-
let mkCLetIn loc name bo t =
266-
CLetIn (loc, (loc, name), bo, t)
265+
let mkCLetIn loc name bo oty t =
266+
CLetIn (loc, (loc, name), bo, oty, t)
267267
let mkCArrow loc ty t =
268268
CProdN (loc, [[dummy_loc,Anonymous], Default Explicit, ty], t)
269269
let mkCCast loc t ty = CCast (loc,t, dC ty)
@@ -1386,7 +1386,7 @@ END
13861386

13871387
let rec splay_search_pattern na = function
13881388
| Pattern.PApp (fp, args) -> splay_search_pattern (na + Array.length args) fp
1389-
| Pattern.PLetIn (_, _, bp) -> splay_search_pattern na bp
1389+
| Pattern.PLetIn (_, _, _, bp) -> splay_search_pattern na bp
13901390
| Pattern.PRef hr -> hr, na
13911391
| _ -> CErrors.error "no head constant in head search pattern"
13921392

@@ -1587,7 +1587,7 @@ GEXTEND Gram
15871587
GLOBAL: closed_binder;
15881588
closed_binder: [
15891589
[ ["of" | "&"]; c = operconstr LEVEL "99" ->
1590-
[LocalRawAssum ([!@loc, Anonymous], Default Explicit, c)]
1590+
[CLocalAssum ([!@loc, Anonymous], Default Explicit, c)]
15911591
] ];
15921592
END
15931593
(* }}} *)
@@ -3381,15 +3381,15 @@ let pf_interp_ty ?(resolve_typeclasses=false) ist gl ty =
33813381
| a, (t, None) ->
33823382
let rec force_type = function
33833383
| GProd (l, x, k, s, t) -> incr n_binders; GProd (l, x, k, s, force_type t)
3384-
| GLetIn (l, x, v, t) -> incr n_binders; GLetIn (l, x, v, force_type t)
3384+
| GLetIn (l, x, v, oty, t) -> incr n_binders; GLetIn (l, x, v, oty, force_type t)
33853385
| ty -> mkRCast ty mkRType in
33863386
a, (force_type t, None)
33873387
| _, (_, Some ty) ->
33883388
let rec force_type = function
33893389
| CProdN (l, abs, t) ->
33903390
n_binders := !n_binders + List.length (List.flatten (List.map pi1 abs));
33913391
CProdN (l, abs, force_type t)
3392-
| CLetIn (l, n, v, t) -> incr n_binders; CLetIn (l, n, v, force_type t)
3392+
| CLetIn (l, n, v, oty, t) -> incr n_binders; CLetIn (l, n, v, oty, force_type t)
33933393
| ty -> mkCCast dummy_loc ty (mkCType dummy_loc) in
33943394
mk_term ' ' (force_type ty) in
33953395
let strip_cast (sigma, t) =
@@ -5384,7 +5384,7 @@ type ssrbindfmt =
53845384
| BFvar
53855385
| BFdecl of int (* #xs *)
53865386
| BFcast (* final cast *)
5387-
| BFdef of bool (* has cast? *)
5387+
| BFdef
53885388
| BFrec of bool * bool (* has struct? * has cast? *)
53895389

53905390
let rec mkBstruct i = function
@@ -5397,15 +5397,12 @@ let rec mkBstruct i = function
53975397
| [] -> []
53985398

53995399
let rec format_local_binders h0 bl0 = match h0, bl0 with
5400-
| BFvar :: h, LocalRawAssum ([_, x], _, _) :: bl ->
5400+
| BFvar :: h, CLocalAssum ([_, x], _, _) :: bl ->
54015401
Bvar x :: format_local_binders h bl
5402-
| BFdecl _ :: h, LocalRawAssum (lxs, _, t) :: bl ->
5402+
| BFdecl _ :: h, CLocalAssum (lxs, _, t) :: bl ->
54035403
Bdecl (List.map snd lxs, t) :: format_local_binders h bl
5404-
| BFdef false :: h, LocalRawDef ((_, x), v) :: bl ->
5405-
Bdef (x, None, v) :: format_local_binders h bl
5406-
| BFdef true :: h,
5407-
LocalRawDef ((_, x), CCast (_, v, CastConv t)) :: bl ->
5408-
Bdef (x, Some t, v) :: format_local_binders h bl
5404+
| BFdef :: h, CLocalDef ((_, x), v, oty) :: bl ->
5405+
Bdef (x, oty, v) :: format_local_binders h bl
54095406
| _ -> []
54105407

54115408
let rec format_constr_expr h0 c0 = match h0, c0 with
@@ -5415,12 +5412,9 @@ let rec format_constr_expr h0 c0 = match h0, c0 with
54155412
| BFdecl _:: h, CLambdaN (_, [lxs, _, t], c) ->
54165413
let bs, c' = format_constr_expr h c in
54175414
Bdecl (List.map snd lxs, t) :: bs, c'
5418-
| BFdef false :: h, CLetIn(_, (_, x), v, c) ->
5415+
| BFdef :: h, CLetIn(_, (_, x), v, oty, c) ->
54195416
let bs, c' = format_constr_expr h c in
5420-
Bdef (x, None, v) :: bs, c'
5421-
| BFdef true :: h, CLetIn(_, (_, x), CCast (_, v, CastConv t), c) ->
5422-
let bs, c' = format_constr_expr h c in
5423-
Bdef (x, Some t, v) :: bs, c'
5417+
Bdef (x, oty, v) :: bs, c'
54245418
| [BFcast], CCast (_, c, CastConv t) ->
54255419
[Bcast t], c
54265420
| BFrec (has_str, has_cast) :: h,
@@ -5443,10 +5437,8 @@ let rec format_glob_decl h0 d0 = match h0, d0 with
54435437
| Bdecl (xs, _) :: bs -> Bdecl (x :: xs, t) :: bs
54445438
| bs -> Bdecl ([x], t) :: bs
54455439
end
5446-
| BFdef false :: h, (x, _, Some v, _) :: d ->
5440+
| BFdef :: h, (x, _, Some v, _) :: d ->
54475441
Bdef (x, None, v) :: format_glob_decl h d
5448-
| BFdef true:: h, (x, _, Some (GCast (_, v, CastConv t)), _) :: d ->
5449-
Bdef (x, Some t, v) :: format_glob_decl h d
54505442
| _, (x, _, None, t) :: d ->
54515443
Bdecl ([x], t) :: format_glob_decl [] d
54525444
| _, (x, _, Some v, _) :: d ->
@@ -5465,12 +5457,9 @@ let rec format_glob_constr h0 c0 = match h0, c0 with
54655457
| Bdecl (xs, _) :: bs, c' -> Bdecl (x :: xs, t) :: bs, c'
54665458
| _ -> [Bdecl ([x], t)], c
54675459
end
5468-
| BFdef false :: h, GLetIn(_, x, v, c) ->
5469-
let bs, c' = format_glob_constr h c in
5470-
Bdef (x, None, v) :: bs, c'
5471-
| BFdef true :: h, GLetIn(_, x, GCast (_, v, CastConv t), c) ->
5460+
| BFdef :: h, GLetIn(_, x, v, oty, c) ->
54725461
let bs, c' = format_glob_constr h c in
5473-
Bdef (x, Some t, v) :: bs, c'
5462+
Bdef (x, oty, v) :: bs, c'
54745463
| [BFcast], GCast (_, c, CastConv t) ->
54755464
[Bcast t], c
54765465
| BFrec (has_str, has_cast) :: h, GRec (_, f, _, bl, t, c)
@@ -5577,11 +5566,9 @@ ARGUMENT EXTEND ssrbinder TYPED AS ssrfwdfmt * constr PRINTED BY pr_ssrbinder
55775566
(FwdPose, [BFdecl n]),
55785567
CLambdaN (loc, [xs, Default Explicit, t], mkCHole loc) ]
55795568
| [ "(" ssrbvar(id) ":" lconstr(t) ":=" lconstr(v) ")" ] ->
5580-
[ let loc' = Loc.join_loc (constr_loc t) (constr_loc v) in
5581-
let v' = CCast (loc', v, dC t) in
5582-
(FwdPose,[BFdef true]), CLetIn (loc,bvar_lname id, v',mkCHole loc) ]
5569+
[ (FwdPose,[BFdef]), CLetIn (loc,bvar_lname id, v, Some t, mkCHole loc) ]
55835570
| [ "(" ssrbvar(id) ":=" lconstr(v) ")" ] ->
5584-
[ (FwdPose,[BFdef false]), CLetIn (loc,bvar_lname id, v,mkCHole loc) ]
5571+
[ (FwdPose,[BFdef]), CLetIn (loc,bvar_lname id, v, None, mkCHole loc) ]
55855572
END
55865573

55875574
GEXTEND Gram
@@ -5605,8 +5592,8 @@ let push_binders c2 bs =
56055592
CProdN (mkloc loc1, b, loop ty c bs)
56065593
| (_, CLambdaN (loc1, b, _)) :: bs ->
56075594
CLambdaN (mkloc loc1, b, loop ty c bs)
5608-
| (_, CLetIn (loc1, x, v, _)) :: bs ->
5609-
CLetIn (mkloc loc1, x, v, loop ty c bs)
5595+
| (_, CLetIn (loc1, x, v, oty, _)) :: bs ->
5596+
CLetIn (mkloc loc1, x, v, oty, loop ty c bs)
56105597
| [] -> c
56115598
| _ -> anomaly "binder not a lambda nor a let in" in
56125599
match c2 with
@@ -5616,9 +5603,9 @@ let push_binders c2 bs =
56165603

56175604
let rec fix_binders = function
56185605
| (_, CLambdaN (_, [xs, _, t], _)) :: bs ->
5619-
LocalRawAssum (xs, Default Explicit, t) :: fix_binders bs
5620-
| (_, CLetIn (_, x, v, _)) :: bs ->
5621-
LocalRawDef (x, v) :: fix_binders bs
5606+
CLocalAssum (xs, Default Explicit, t) :: fix_binders bs
5607+
| (_, CLetIn (_, x, v, oty, _)) :: bs ->
5608+
CLocalDef (x, v, oty) :: fix_binders bs
56225609
| _ -> []
56235610

56245611
let pr_ssrstruct _ _ _ = function
@@ -5784,8 +5771,8 @@ let binder_to_intro_id = List.map (function
57845771
| (FwdPose, [BFvar]), CLambdaN (_,[ids,_,_],_)
57855772
| (FwdPose, [BFdecl _]), CLambdaN (_,[ids,_,_],_) ->
57865773
List.map (function (_, Name id) -> IpatId id | _ -> IpatAnon) ids
5787-
| (FwdPose, [BFdef _]), CLetIn (_,(_,Name id),_,_) -> [IpatId id]
5788-
| (FwdPose, [BFdef _]), CLetIn (_,(_,Anonymous),_,_) -> [IpatAnon]
5774+
| (FwdPose, [BFdef]), CLetIn (_,(_,Name id),_,_,_) -> [IpatId id]
5775+
| (FwdPose, [BFdef]), CLetIn (_,(_,Anonymous),_,_,_) -> [IpatAnon]
57895776
| _ -> anomaly "ssrbinder is not a binder")
57905777

57915778
let pr_ssrhavefwdwbinders _ _ prt (tr,((hpats, (fwd, hint)))) =

0 commit comments

Comments
 (0)